• 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.

App advice

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

  • App advice

    I have a simple NAB app that displays a grid. The on-click action displays a form with a lot of info and two buttons.
    Button 1: The VOID button takes an action through an external web service.
    Button 2: The CANCEL button closes the form and re-displays the grid.

    I have another action (REPRINT LABEL) that I'd like to assign to a selected grid row... This action would require the user to enter (or select from dropdown) a list of label printers on the IBM system.

    I thought about adding the button to the existing form, but I would need to add a blank field or dropdown.

    I considered creating a second form, accessed by the first form, to allow the user to enter the label printer.

    Honestly, I'm not sure what all of my options are... Just looking for ideas to make this easy for the users.
    TIA

    Greg


  • #2
    Greg,

    When calling an RPG program from a button click you can prompt for more information before calling your program.

    You could create a data source that has all the valid label printers then use that data source in your prompt for more information dropdown field setup for when the user clicks "REPRINT LABEL".

    Comment


    • #3
      That's great!

      But how do I get the data from the prompted value inside the RPG pgm?

      Comment


      • #4
        Greg,

        You would get the value with vvIn_Char passing whatever you named the field. Example of this however with a file upload can be seen in this developer diaries episode.

        Comment


        • #5
          Perfect. Thank you!

          Comment


          • #6
            I have also included a "print" button on my grid. This works fine. However, I added a Condition to the button that doesn't seem to be working:

            The condition expression is
            {F1_LABEL1} <> ' ' && {F1_REFUND} = ' '

            I was thinking this would display a button only when the F1_LABEL1 field is not equal to blank and the F1_REFUND field is equal to blank.

            Am I missing something?

            YES I was missing this...

            I need to use Javascript conditional expression (this works)
            {F1_LABEL1} != ' ' && {F1_REFUND} == ' '
            Last edited by gwilburn; 08-04-2020, 04:04 PM.

            Comment


            • #7
              Greg,

              Glad you figured it out and for anyone stumbling onto this thread you can find information on javascript comparison operators here.

              Comment


              • #8
                Johnny... this quit working. Not sure why, but I've isolated it to {F1_REFUND} == ' '

                That field is a CHAR(15) field. Surely i don't need 15 spaces?

                Comment


                • #9
                  Greg, you definitely should not need to check for 15 empty spaces. What does the data look like for the row that is not working as you expect?

                  Comment


                  • #10
                    So the condition needs to be that F1_LABEL1 is not blank AND F1_REFUND is blank.

                    Both are character fields, but the "label1" field is varchar(128) and "refund" is char(15).

                    My condition works fine with the label1 field only. The issue is when I'm referencing the "refund" field looking for blank.

                    So the corresponding SQL statement that correctly selects records looks like this:
                    Code:
                    select * from tbfapis.elslog
                    where label1 <> ' ' and refund = ' ';
                    Any time I add the condition that includes field "refund", the app button is not available (i.e. false)

                    Comment


                    • #11
                      So I assume that your snippet within NAB is:

                      Code:
                      {F1_LABEL1} !== '' && {F1_REFUND} === ''
                      If that does not work then maybe try this:
                      Code:
                      {F1_LABEL1} !== '' && {F1_REFUND}.trim() === ''

                      Comment


                      • #12
                        This did the trick:

                        {F1_LABEL1} !== '' && {F1_REFUND} === ''

                        Missing a few "=" in my original.

                        Comment

                        Working...
                        X