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

Problems using 'One To Many' relationship when loading data.

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

  • Problems using 'One To Many' relationship when loading data.

    Having a few problems trying to use a 'One to Many' (BelongsTo) relationship in loading data from the iSeries into an Appointment calendar.

    Was wondering if you had tried anything like this before.

    Have tried to use the vvOut_toJsonPair and vvOut_toJson but can't get the format write that gets sent to the Javascript.

    When we load from the data from an inline file containing test data we get the data in one format when we try calling from the iSeries it's totally different.

    I've attached a copy of our data file appointment.json, this how we need the data to render.

    appointments.txt

    Thanks

  • #2
    Unfortunately there are no convenient ways to output nested arrays like that using standard vvOut procedures. So in your case you'd either have to build the JSON string manually in your RPG program -- i.e., create a loop that fetches the records, builds out the string in JSON format and outputs it to the front-end via vvOut_data(string:JSON) -- or write something in JavaScript to manipulate the data coming from your RPG program into the JSON format required by your calendar app.

    You can see an example of a manual back-end build of a JSON string with nested arrays in RPG program VVADM_CATS, procedure getCats.

    Comment


    • #3
      No problem Rob,

      We've got it working by sending up an array of data and then manipulating into the correct stores in Javascript.

      We just thought we'd double check and see if they was cleaner way to do it.

      Thanks.

      Comment

      Working...
      X