• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Modifying a data source from a widget grid value

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Modifying a data source from a widget grid value

    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.

  • #2
    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

    Comment


    • #3
      Lots of valuable information in the video and blog post. Thank you. For the Default Value for a date field virtual variable, it appears it has to be an actual date. Is there any way I can default it to the last day of the previous month or the first row of another grid?

      Comment


      • #4
        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


        • #5
          Sorry for the delay in responding. I am trying to roll the filter value into multiple widgets simultaneously.

          Comment


          • #6
            If you want a single filter to affect more than one widget your best bet would be to create a Form widget that serves as a search.

            See the "Customer Overviews" sample application for an example.

            Comment


            • #7
              Thank you. Where would I find this sample application? I haven't had any luck googling it

              Comment


              • #8
                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


                • #9
                  Found it. Thank you

                  Comment

                  Working...
                  X