I have an app that has SQL for all the data sources for my widgets. I want the default vale of the date to be Today's date and then I retrieve the month-end data depending upon todays' date. I also have a grid where the user can select the last day of the month of any of the previous months from the current year and the previous year. After the user clicks on the date they want, I want the data sources to repopulate using the date value the user clicked. I think I need to do this with virtual variables but I can't figure out how to get them to work. I've never used virtual variables and am also a novice NAB developer. I hope I've explained this properly. Any help would be appreciated.
Announcement
Collapse
No announcement yet.
Modifying a data source from a widget grid value
Collapse
X
-
Hi Ruth Ann,
You can find more details on virtual variables in this video: https://www.youtube.com/watch?v=trzcMgjiD2U
and this blog post: https://www.cnxcorp.com/blog/turbo-c...tual-variables
-
Sounds like you could probably just set an initial value on your grid widget's date field user filter, thereby not needing a vvIn_virtual(). There are quite a few options for having a date field filter default to the start or end of a month, and if you need something more complicated than that you can have the widget call a simple RPG program to initialize the filter value to whatever you want. This is specified in the "Settings" on the filter tab, which is on the right edge of the widget when you're in the Designer. The RPG program name goes in the "Initial Value PGM" field.
Using vvIn_virtual() in this particular case might be overkill, unless you're trying to roll the user's filter value into multiple widgets simultaneously, or need special logic inside an SQL WITH clause, or something more "advanced" like that...
By the way, this is one of the topics we cover in depth our periodic on-line NAB training labs. There is space available in the upcoming session that starts on June 6 if you're interested. You can send an email to CNX support for more info.
Comment
-
Should be under the category "Examples - Nitro App Builder" and if you want to see the application within App Builder click the settings icon "cogwheel" and click show examples
NAB Settings.png
Comment
Comment