cancel
Showing results for 
Search instead for 
Did you mean: 

Date conversions

Former Member
0 Kudos

Hi,

I have issues in populating date values from Front page to SQL database.

User selects a date from iCalendar. It is passed to a transaction that populates a database table.

I pass date in the format "yyyyMMddTHH:mm:ss" (which is a string) from front page to the transaction.I have a transaction property which is a string to receive this incoming date. I make a date format conversion to "yyyyMMdd HH:mm:ss" for inserting it into database. But date conversion fails...Database has a datecolumn of type datetime because I have to calculate date and time differences also.

Please let me know whether I have to have a transaction property as datetime for insertion into database.

In that case how can I pass my date value from front page??

Your inputs will be valued...

Thanks,

Ajitha

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Ajitha.

If you are not using an applet, then you can call the transaction with any input and output transaction properties right from the url like this...

http://localhost/Lighthammer/Runner?Transaction=TestMe&ED=2006-01-01T00:00:00&OutputParameter=Output

...where localhost is the servername, Runner is the servlet which handles the transaction request/response, Transaction is the path from the Lighthammer/Transactions folder, ED is the input transaction property in XML DateTime format, and OutputParameter is the name of the mapped output transaction property defined.

Regards,

Michael Teti

Former Member
0 Kudos

Ajitha - Use the URL that MIchael gave you. You dont have to use the SD and ED that he discussed but using the MappedTargeParam and Param.# query string properties you can pass in params. Below is a snippet of myquerystring URL code calling an XACUTE

chartURL += "&Param.2=" + Date;

chartURL += "&MappedParamTarget.2=pFromDate";

We had some issues with the Date format from the URL but within our BLS we did an assignment action with this expression:

datetoxmlformat(Transaction.pFromDate,"MM/dd/yyyy" )

Hope this helps...

Former Member
0 Kudos

Ajitha,

xMII transactions do support transaction properties of datatype "datetime". Remember that XML datetime format is "yyyy-MM-ddTHH:mm:ss".

Consider creating two datetime transaction properties: SD and ED. From the Xacute query which calls this transaction, goto the "Input Params" tab and map the SD and ED properties to the Start Date mapped input and End Date mapped input. now the Xacute query's start date and end date parameters, found under the date range tab, will be passed into the transaction's properties.

From your html page, use the following xMII javascript object methods to pass the iCalendar's value to the query's start date and end date:

document.myApplet.getQueryObject().setStartDate(stringSD);

document.myApplet.getQueryObject().setEndDate(stringED);

You should now be able to pass the datetime format into the transaction in datetime format. From the SQL Query action block's Incoming tab, map the SD transaction property to the QueryStartDate property. Do the same for the ED property.

PLEASE NOTE: There are two ways to pass the DateTime into an xMII query...

QueryStartDate (XML DateTime format)

StartDate (String Format)

Hope this helps!

Regards,

Michael Teti

Former Member
0 Kudos

Michael,

I tried using "datetime" in transaction properties...

Problem here is I dont have to display any results.

I thought of using an icommand to execute my Xacute query..

In that case how can I set params to my Xacute query, since there are no applets involved... Let me know your thoughts....

thanks,

Ajitha