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

vvIn_Char not returning as expected

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

  • vvIn_Char not returning as expected

    I'm not sure if this is a bug or if I'm just not understanding. I have an app that uses an AJAX vvcall and when the RPG triggers and uses vvIn_Char it doesn't return what I'd expect. If the app were launched with URL parms like:
    image.png?
    and that app then does the AJAX vvcall passing that invoice as part of the input of the AJAX call, then the vvIn_Char is picked up as "my invoice", which is expected. However, if instead the app were launched with URL parms like:
    image.png?
    (initInvc is an app var with the content "my invoice") and that app then does the AJAX vvcall passing that as part of the input of the AJAX call, then the vvIn_Char is picked up as "my%20invoice", which I did not expect. Rather than vvIn_Char returning the input passed into the AJAX call, it is somehow only seeing the URL input parm passed into the app itself and encoded as it would be in a URL.
    To fix this I am going to change the name of the input into the AJAX call to not match the name of the app URL input parm, but I don't understand why the vvIn_Char would do different behavior between the launch cases of "[initInvc]" versus "my invoice".

    Script:
    Code:
    try {
      var myParms = {
          "invoice": getAppVar('invoice')
          ,
          "pgm":"APRTEST2",
          "action":"print"
      };
      
      Ext.Ajax.request({
                url: '/valence/vvcall.pgm',
                params: myParms,
                scope: this,
            success: function(response) {
                setAppVar('nabInfo', 'Pgm called');
            },
            failure: function() {
                setAppVar('nabMsg', 'Pgm call failed');
            }
        });
    } catch (ex) {
      console.error(ex);
    }
    
    success();?
    RPG:

    Code:
    **Free
    /Include SpcHdrDft
    /Include QCpyLESrc,vvDspec 
    
    Dcl-S Invoice Char(24);
    
    Invoice = vvIn_char('invoice');
    
    vvOut_toJsonPair('success:true'); // I put a break point here to see what the value of the invoice variable is
    
    *InLR = *On;
    Return;?


    image.png?


    Thanks

  • #2
    What version of Valence are you currently on?
    Last edited by Johnny Major; 01-20-2026, 07:39 PM. Reason: update text

    Comment


    • #3
      Disregard, we have replicated the issue and hope to have it fixed in the next 6.3 update. We will report back on this post once it is fixed. Thanks for the information!

      Comment


      • #4
        Thank you!

        Comment


        • #5
          NAB automatically applies all the original URL parameters (from when the app was launched) to every XHR request. So even though you're manually passing your own invoice value in the script, NAB overwrites it with the original invoice parameter you provided to the Helper Test app.

          You did find a real bug, the unwanted %20 appearing in that XHR parameter, and we'll get that fixed in the next 6.3 update.

          The core behavior here means the custom XHR request won't see any runtime changes to the invoice app variable, because NAB keeps reapplying the launch-time parameters. Since you're building the XHR request manually (and not using the backend program template to get passed app variables), the simplest and cleanest solution is to use a different parameter name in your XHR call, one that doesn't clash with the original URL params.

          Hope that makes sense.?

          Comment


          • #6
            Okay, that makes sense. I'll make sure the XHR parms are all named differently than the URL parms in the future. Thanks for looking into it.

            Comment

            Working...
            X