Data Factory Dynamic Expression using CRM 365 FetchXML - azure-data-factory

I am trying to convert this dynamic expression in ADF
<fetch mapping="logical" version="1.0">
<entity name="account">
<attribute name="createdon" />
<filter>
<condition attribute="createdon" operator="ge" value="2020-10-20T00:00:00Z" />
<condition attribute="createdon" operator="le" value="2020-10-20T23:59:59Z" />
</filter>
</entity>
</fetch>
Replacing the Date with a variable or possibly a parameter, if someone can help with this please on how he expression should look like ?
Thank you

Replace the date value in the script as #{variable('variable_name')} . I tried to repro this. Two variables date1 and date2 of string type are created in ADF and assigned default value. Value should be given within single quotes or double quotes.
#{variable('variable_name')} is inserted into the expression and the expression looks as in below snippet.
Query
<filter>
<condition attribute="createdon" operator="ge" value=#{variables('date1')} />
<condition attribute="createdon" operator="le" value=#{variables('date2')} />
</filter>
Instead of giving the value for the variable within quotes,
#{variables('date1')} can be wrapped within quotes like "#{variables('date1')}".
This way, variables can be used in dynamic expression in ADF.

Related

Mybatis generator configuration set tableName case sensitive

This is my xml configuration:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<context id="DB2SAMPLE" defaultModelType="flat" targetRuntime="MyBatis3">
<plugin type="org.mybatis.generator.plugins.RenameExampleClassPlugin">
<property name="searchString" value="Example$"/>
<property name="replaceString" value="Criteria"/>
</plugin>
<plugin type="org.mybatis.generator.plugins.CaseInsensitiveLikePlugin" />
<plugin type="org.mybatis.generator.plugins.RowBoundsPlugin" />
<commentGenerator>
<property name="suppressAllComments" value="true" />
</commentGenerator>
<jdbcConnection driverClass="com.ibm.db2.jcc.DB2Driver" connectionURL="jdbc:db2://LOCALHOST:50000/mydb" userId="username" password="password">
</jdbcConnection>
<javaModelGenerator targetPackage="foo.package" targetProject="src/main/java">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="false" />
</javaModelGenerator>
<sqlMapGenerator targetPackage="foo.package" targetProject="src/main/resources">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<javaClientGenerator type="XMLMAPPER" targetPackage="foo.package" targetProject="src/main/java">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<table schema="SCHEMA" tableName="MyTable" alias="MYTABLE" domainObjectName="MYTABLE"/>
</context>
</generatorConfiguration>
The problem is that it not found the table MyTable because it search MYTABLE.
How can I setup MyBatis generator for searching case sensitive name MyTable?
Thanks.
From https://www.codeday.top/2016/12/22/6853.html
1, If schema,catalog or tablename There are spaces in , So what format is set , On the exact use of the specified format to query ;
2, otherwise , If the database identifier uses uppercase , that MBG Automatically turn table name into uppercase search ;
3, otherwise , If the database identifier uses lowercase , that MBG Automatically turn table name to lowercase search ;
4, otherwise , Query using the specified case format ;
Additional , If the table is created , Using "" Specify database object size , Even if the database identifier is used , In this case a table name is created using a given case size ;
At this time , Please set delimitIdentifiers="true" Case preserving format ;

Mybatis Generator's bug: configuration items should be ordered?

If I put "<commentGenerator>" after "<jdbcConnection>", MBG proposed an error that context content should match: blablabla...
But when I put "<commentGenerator>" before "<jdbcConnection>", everything is ok. Here I have something to complain to the official website that if the order of these items is need, why you do not tell us! What an important thing! You r kidding the freshmen. Maybe it is some where I do not know, but this is a key point to build the MBG's configuration file successfully, why not put this NOTE on the top of the tutorial or somewhere eye-catching?
<generatorConfiguration >
<classPathEntry location="D:\mariadb-java-client-1.1.7.jar" />
<context id="db" >
<commentGenerator>
<property name="suppressAllComments" value="true" />
<property name="suppressDate" value="true" />
</commentGenerator>
<jdbcConnection driverClass="org.mariadb.jdbc.Driver"
connectionURL="jdbc:mariadb://localhost:3306/dbname"
userId="root"
password="password"
/>
<javaTypeResolver >
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- Model Class -->
<javaModelGenerator targetPackage="org.infrastructure.model" targetProject="infrastructure\src\main\java">
<property name="enableSubPackages" value="false" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- XML Files -->
<sqlMapGenerator targetPackage="sqlMap" targetProject="infrastructure\src\main\config">
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<!-- DAO -->
<javaClientGenerator type="XMLMAPPER" targetPackage="org.infrastructure.dao" targetProject="infrastructure\src\main\java">
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<!-- Tables -->
<table tableName="user" domainObjectName="User" ></table>
</context>
</generatorConfiguration>
First of all, in your xml configuration file, it doesn't contains a valid root element, which always should be like <!DOCTYPE .../>. About how to add a correct root element of mybatis generator configuration file, please see example from MyBatis GeneratorXML Configuration File Reference.
If you correctly specified root element such as following:
<!DOCTYPE generatorConfiguration PUBLIC
"-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"
>
This root element contains a typical DTD declaration located at http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd. This is the definition of the order of these items is need. And we are going to see what it looks like.
From line 47 of this document type definition, it defines element named context. The content is as following:
<!--
The context element is used to describe a context for generating files, and the source tables.
-->
<!ELEMENT context (property*, plugin*, commentGenerator?, jdbcConnection, javaTypeResolver?,javaModelGenerator, sqlMapGenerator?, javaClientGenerator?, table+)>
Which obviously defined the order of the element in context, that is:
property*, plugin*, commentGenerator?, jdbcConnection,
javaTypeResolver?,javaModelGenerator, sqlMapGenerator?,
javaClientGenerator?, table+
In this element, all children must occurs as following rules:
+ for specifying that there must be one or more occurrences of the item — the effective content of each occurrence may be different;
* for specifying that any number (zero or more) of occurrences is allowed — the item is optional and the effective content of each occurrence may be different;
? for specifying that there must not be more than one occurrence — the item is optional;
If there is no quantifier, the specified item must occur exactly one time at the specified position in the content of the element.
After we understanding its real meaning, why you could not change the order of commentGenerator and jdbcConnection should be clear.
Maybe you want to know how to make the element out of order, question How to define DTD without strict element order could be useful.
Wish it helpful.

IzPack: Require at least one of multiple packs

I've got a software that consists of different plugins that can be selected during installation in IzPack. These plugins provide different features to the software: input, processing, output. The software needs at least one input and output plugin to work.
How do I specify that at least one plugin providing a certain feature is selected in the PackPanel?
I believe that this was implemented in izpack v5.0.0-rc5 and newer. PacksPanel does not allow you to continue if you have deselected all the options.
Based on your comment I would solve this by using conditionvalidator:
Basically add condition for each of your packs:
<condition type="packselection" id="pack1inputselected">
<name>Pack 1 input</name>
</condition>
Then make OR conditions with groups of your packs (input, processing, output), e.g. like this:
<condition type="or" id="inputgroup">
<condition type="ref" refid="pack1inputselected" />
<condition type="ref" refid="pack2inputselected" />
</condition>
Then add a final AND validation condition (id is crucial as it has to always start by conditionvalidator word! The conditionvalidator class gets to validate all the conditions starting with conditionvalidator.):
<condition type="and" id="conditionvalidator.packsselected">
<condition type="ref" refid="inputgroup" />
<condition type="ref" refid="processinggroup" />
<condition type="ref" refid="outputgroup" />
</condition>
Add conditionvalidator to PacksPanel in panels element:
<panel classname="PacksPanel" id="panel.packs">
<validator classname="com.izforge.izpack.installer.validator.ConditionValidator" />
</panel>
There. Everytime the condition that is validated (when clicking on next) by conditionvalidator will not be true (that is if you will not have the correct packs selected), it will throw a message and will not allow you to continue. You can change the message by adding string to CustomLangPack with .error.message (e.g. in this example conditionvalidator.packsselected.error.message).

Microsoft Dynamics CRM 2011 PlugIn RetrieveMultiple Does not return custom attribute on pricelist

I am writing a simple PlugIn for Dynamics CRM 2011 which should retrieve a custom attribute which I customized in the pricelist entity.
When I execute the following code, all standard attributes are returned, but not the one custom attribute which I customized (and published of course). I don't get an error, but simply the attribute 'axi_submarketid' is not returned. If I read data from a completely custom entity, I have no problem.
string fetch = string.Format(#"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
<entity name='pricelevel'>
<attribute name='name' />
<attribute name='transactioncurrencyid' />
<attribute name='enddate' />
<attribute name='begindate' />
<attribute name='statecode' />
<attribute name='pricelevelid' />
<attribute name='axi_submarketid' />
<order attribute='name' descending='false' />
<filter type='and'>
<condition attribute='pricelevelid' operator='eq' uiname='10 Stromlieferung' uitype='pricelevel' value='{0}' />
</filter>
</entity>
</fetch>", pricelevelid);
EntityCollection pricelevel = _service.RetrieveMultiple(new FetchExpression(fetch));
What am I doing wrong?
Thanks for help,
Peter
I solved my issue myself and it is a bit embarassing :-)
The expected attribute was not deliverd, because it had no content. Meaning, not only in the direct context of a PlugIn, but also when requesting data in general: if in an attribute there is no data, the attribute is not sent back, for example if the attribute is NULL or has no value in it.
Thanks anyway, hope this question and answer helps someone else.
Regards,
Peter

Is it possible to assign default values to NAnt properties?

I'd like to use the property value as a part of an argument passed to a certain EXE via <exec/> task. There's a condition which influences the property initialization, that is, if condition is true, it should contain value, otherwise be just empty (but still defined).
This is what I ended up so far:
<property name="prop1" value="" />
<property name="prop1" value="some-value-based-on-condition" if="condition-goes-here" />
And later on:
<exec program="my.exe">
<arg value="C:\Root\Folder\${prop1}" />
...
</exec>
If the property is not set, I'd like to pass just C:\Root\Folder\ as an argument value.
Initializing the property in this way seems too much for such a simple operation. Is there a way to do it simpler using what's in NAnt at the moment? I would imagine something like:
<property name="prop1" value="somevalue-based-on-condition" if="condition" default="" />
The example below should meet your needs. It will create a property named 'SolutionConfiguration' and assign it the value 'Release' if and only if the same parameter isn't already defined (ie. it was defined via the command line).
<property name="SolutionConfiguration" value="Release" unless="${property::exists('SolutionConfiguration')}" />
For your scenario, try
<property name="RootFolder" value="c:\Root\Folder" unless="${property::exists('RootFolder')}" />
<exec program="my.exe">
<arg value="${RootFolder}\${prop1}" />
...
</exec>
Use overwrite="False"
<property name="RootFolder" value="c:\Root\Folder" overwrite="false" />