Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Select database entry, update display element and report

Questions related to using nuBuilder Forte.
Post Reply
stevenmiller
Posts: 25
Joined: Mon Jul 06, 2020 4:23 pm
Has thanked: 3 times

Select database entry, update display element and report

Unread post 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
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: Select database entry, update display element and report

Unread post 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#'
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: Select database entry, update display element and report

Unread post by kev1n »

HI Steven,

Were you able to get it to work?
Post Reply