Anthony Hyams
Posts: 0
Joined: Tue Apr 01, 2014 10:54 am

Using a value from a query service in javascript

I want to take a date value from the current query and reformat it and output this to a label.

I've mapped the date value to a label and this works fine. I thought it would be possible to add some javascript to this mapping so I could take the date , format it as required and then output that to the label.

The formatting is not a problem but how do I access the date value from the current query in javascript so I can manipulate it.

Tony

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Using a value from a query service in javascript

Hi Tony,

Could you please clarify what you mean by 'take a date value from the current query'? Do you read a database date value and want to save it in a label?

Anthony Hyams
Posts: 0
Joined: Tue Apr 01, 2014 10:54 am

Using a value from a query service in javascript

I am looping through a set of data from a database collection and mapping it to labels in a collapsible list. It is a list of events with event title etc and the date and time of the event stored as a date/time e.g. 2014-05-31 10:00:00:00 . All works well. However I don't want to map the date/time as above as it is difficult to read and in this particular case the date is irrelevant as the query is already filtered for the date. all I want is the time portion as am/pm

I assumed as the page looped through the query adding each event to the collapsible list when I got to the date I would be able to insert some javavscript at that point which would read in the date from the current record (which I was mapping to a label), I could then manipulate the date and write the formatted value back to the label. How do I read the data in javascript.

Anthony Hyams
Posts: 0
Joined: Tue Apr 01, 2014 10:54 am

Using a value from a query service in javascript

Why is this set to answered not been answered at all

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Using a value from a query service in javascript

Hello Anthony,

Sorry for delay, we are working on it at the moment. We will get back to you with update.

Anthony Hyams
Posts: 0
Joined: Tue Apr 01, 2014 10:54 am

Using a value from a query service in javascript

Sorted it myself, after reading answers for various other problems could see how it worked.

If I map an data item to a label I can use that value when adding javascript by simply referring to it as value

eg
var newvariable = value;

now I can work with the data and write it back

return newvariable;

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Using a value from a query service in javascript

Thank you for the update. Let us know if you need any further help.

Return to “Issues”