Announcement

Collapse
No announcement yet.

vvOut.file

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

  • vvOut.file

    Hi there. I am using Valence in association with Sencha.

    I am having trouble trying to get a PDF file to open. When I do the Test RPG call to my RPG program, the PDF generates and opens for me to view. When I go to my GUI and call the same RPG program with the same parameters, I am getting a weird error about invalid JSON. 'Ext.JSON.decode(): You're trying to decode an invalid JSON String.

    Am I missing something? If the Test RPG Call is working is this something on the Sencha side that is wrong?


  • #2
    Ext.JSON.decode is meant to decode JSON and your RPG program isn't responding with JSON

    It works in Test RPG Call because when Test RPG gets the response it checks the 'content-type'. If it's not JSON and for example application/pdf then it will set up an iframe to display the PDF

    You could use Valence.util.Helper.download which will call your RPG program and then download the file

    Comment


    • #3
      Thank you so much for the response!

      Ok, so I changed my code in the GUI to use Valence.util.Helper.download({}) with all of the parameters, action and program set.

      I tested this out in my application and it calls the RPG program successfully. I get a 200 status (Ok) in the console log for the call, but nothing happens on the screen.

      In my program I have set up:
      vFileName = 'Name';
      vvOut.download = '1';
      vvOut.file = vFileName + '.pdf';
      vvOut_file(WkEnvRtv:vvOut);

      Where WkEnvRtv is the file path. Is this the right way to use the file option with the Valence.util.Helper.download()?

      Comment


      • #4
        Oh nevermind! That actually worked! I wasn't waiting long enough for the PDF to appear in the bottom! Thank you so much!

        Comment

        Working...
        X