cancel
Showing results for 
Search instead for 
Did you mean: 

Using [SD]/[ED] parameters in queries. xMII 12.1.1

Former Member
0 Kudos

Hi All,

I've been investigating usage of "[SD]" and "[ED]" parameters in Query Templates and now have some statements either for confirmation or for disproof.

- Values only in XML-datetime format should be assigned to StartDate & EndDate parameters in xMII transactions?

If SD & ED are unparsable I noticed that xMII assigns the following values: EndDate = datenow, StartDate = datenow - 1hour.

- if EndDate is not in XML-datetime format it is built as StartDate + 1 hour?

- EndDate which is earlier than StartDate is ignored and StartDate value is assigned to EndDate?

- InternalDateFormat setting defines how the dates (SD/ED) are sent to the database server (in a SQL query) and to avoid localization problems (e.g. mm/dd/yyyy vs. dd/mm/yyyy) it should be used in conjunction with corresponding DatePrefix and DateSuffix.

Thanks for your comments,

Dmitry

Accepted Solutions (0)

Answers (1)

Answers (1)

jcgood25
Active Contributor
0 Kudos

- Values only in XML-datetime format should be assigned to StartDate & EndDate parameters in xMII transactions?

If SD & ED are unparsable I noticed that xMII assigns the following values: EndDate = datenow, StartDate = datenow - 1hour.

By using the DateTime format for the transaction inputs it keeps your variable types consistent and all of the use cases within your transaction thereby have a known starting point for conversions.  In addition if you use an XacuteQuery template to call the TRX the Mapped Start/End Date properties will allow you to use the MII query time engine just like you would with [SD] and [ED] in a sql query and when using an applet it will allow the full time control bar to be used.  You'll also notice numerous action blocks, like the Document and Query actions have properties for direct linking these properties.  In the case of the query actions all of formatting is handled by the action block and you can link from Transaction.SD to SQLAction.QueryStartDate and it will automatically convert from the XML date format to the query template's DateFormat and assign to the StartDate parameter. (so in other words you have less work and hard coded string formatting to mess with - way more dynamic).

- If EndDate is not in XML-datetime format it is built as StartDate + 1 hour?

This depends a bit on where / how you are using the dates within the query or TRX

- EndDate which is earlier than StartDate is ignored and StartDate value is assigned to EndDate?

There is no time machine for going backwards and the Start must always come before the end, so when time is not chronological it will lock the dates to each other.

- InternalDateFormat setting defines how the dates (SD/ED) are sent to the database server (in a SQL query) and to avoid localization problems (e.g. mm/dd/yyyy vs. dd/mm/yyyy) it should be used in conjunction with corresponding DatePrefix and DateSuffix.

If your query is SELECT * FROM Table WHERE DateColumn BETWEEN [SD] and [ED] the query going through the DB driver will take the relevant date string format it with DatePrefix + Token converted into InternalDateFormat + DateSuffix (where the settings come from the Data Server settings).  SQL Server is simpler with single quotes and more forgiving for the date format, whereas with Oracle you have to deal with the format and the TO_CHAR prefixing, so this allows simpler queries to be built, and by using the date tokens in conjunction with the MII query time engine allow all of the formatting and conversions to be handled by the data server itself.

Former Member
0 Kudos

Thanks, Jeremy.

Just to make sure, is it true that database NLS settings and InternalDateFormat have nothing in common? As long as the chain "DatePrefix + InternalDateFormat + DateSuffix" is built correctly in MII it should work with any regional timestamp format (while DB vendor is the same).

jcgood25
Active Contributor
0 Kudos

The point is that for every given JDBC connection that uses an MII Data Server, the parameters are configurable to the specific database. This is done at a common level for all query templates built against that named data server.