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

Button program in Error after running script

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

  • Button program in Error after running script

    Hi,

    I have a button that runs a validation program and, if the grid filters are validated, a script is run through behaviours. This script creates a client generated PDF through pdfMake.

    This only works once.
    After the pdf is created, the grid isn't responding to new filter settings anymore
    If I click the button again, my validation program fails:

    PHP Code:
    CPF9898 Expected a colon after a key.

    VVCALL[VVCALL]VALLOC001R[VALLOC001R]VALLOC001R[INITIALIZE]JSON{JSON_PAR}[json_parse]JSON{JSON_PAR}[NEXTARRAY]JSON{JSON_PAR}[NEXTVALUE]JSON{JSON_PAR}[json_parse]JSON{JSON_PAR}[NEXTOBJECT
    Kind regards,
    Theo

  • #2
    Hi Theo,

    When you say your button runs a validation program do you mean you have a button that calls an RPG program based on "EXNABBTN"? Then on success, you have a script that is run which creates a PDF

    Thanks

    Comment


    • #3
      Hi Johnny,
      Yes, thats correct.
      Theo

      Comment


      • #4
        Ok, so if you comment out your script that creates the PDF does the call to your program via the button click then work every time?

        Thanks

        Comment


        • #5
          This is the last part my my script now, the rest is unchanged.
          Now the grid keeps working

          PHP Code:
           // Generate the Pdf
          //
          // pdfDocGenerator = pdfMake.createPdf(docDefinition);
          // pdfDocGenerator.getDataUrl().then(function (dataUrl) {
          // update the appvar url so that the viewer shows the new
          // pdf report
          // setAppVar('urlPdf', dataUrl);
          // Valence.common.util.Helper.destroyLoadMask();
          // success();
          // }, failure);
          Valence.common.util.Helper.destroyLoadMask();
          success();
          }, 
          failure);
          }, 
          failure);
          }, 
          failure); 

          Comment


          • #6
            All app variables are passed down on each call and since you were placing the data URL in an app var that would be passed down making the request too large. I would suggest instead of doing the getDataUrl using the download method directly from pdfMake.

            Comment


            • #7
              If you're using the 'getDataUrl' so you can view the PDF in a URL Widget you could name that widget and pull it in and set the source manually.

              For example, I have a URL widget in my application that is named "pdfUrlWidget" and I am getting that widget and calling its setSource method passing the dataUrl.

              Code:
              pdfDocGenerator.getDataUrl().then(function (dataUrl) {
                  // get the URL Widget that is named "pdfURLWidget"
                  //  and set the source with the data URL
                  //
                  var pdfUrlWidget = getWidget('pdfUrlWidget');
                  pdfUrlWidget.setSource(dataUrl);
              
                  Valence.common.util.Helper.destroyLoadMask();
                  success();
              }, failure);

              Comment

              Working...
              X