Page 1 of 1

Select database entry, update display element and report

Posted: Mon Aug 10, 2020 12:10 pm
by stevenmiller
Hi Forum,
I have a select element, where I can choose an element in the table and then I click the run button to generate a report out of this element, which works fine. My problem is, that the element consists of a time-stamp and I want just the date out of it in the report without the time. I can successfully separate the date in a display element, but this is only updated, when I click save, than I have to choose the right entry in the select button again and then both can be shown in the pdf. My question is, how can I make it a "one click action"?
The select element has this code

Code: Select all

Select timestamp ,DATE_FORMAT(timestamp,'%d.%m.%Y') FROM events

can I set the DATE_FORMAT(timestamp,'%d.%m.%Y') as a cookie or something, that I can use it in the report? Or can I manipulate the timestamp into just date in the report?
Unfortunately I can't change the timestamp just to date or have a just date column in the table.
What would be a solution for my problem?
Thanks in advance
Regards
Steven

Re: Select database entry, update display element and report

Posted: Mon Aug 10, 2020 12:20 pm
by kev1n
Hi Steven,

You can set a Hash Cookie when the button is clicked.
To do so, add an onclick Event in the Custom Code of your button.

Code: Select all

nuSetProperty('date_hash_cookie', $("#myselect option:selected").text());
In the Report SQL, you can reference it like this

Code: Select all

WHERE your_date_column = '#date_hash_cookie#'

Re: Select database entry, update display element and report

Posted: Fri Aug 14, 2020 5:38 pm
by kev1n
HI Steven,

Were you able to get it to work?