[ardoJSON] Record List Serialization w/o Current Record

[ardoJSON] Record List Serialization w/o Current Record

  
Forge Component
(21)
Published on 30 Aug by Ricardo Silva
21 votes
Published on 30 Aug by Ricardo Silva
Hi Ricardo - I'm having an issue where my Record List is being serialized with the .Current Record in the 1st position.  This results in a repeated value for the 1st and last positions in the output. Can I do something to prevent this?

Thanks.
Can you provide an example eSpace where this happens? And also let me know the stack you're using (.NET or Java).

You probably shouldn't export the list to JSON while you're iterating it. Are you doing this?
No, not iterating over it.  This is a resultant output from an action.  Here is just a small example from the debug output.  In image 1, the debug is in the gray area with the current record expanded.  You can see from the actual lsit, that it is the last value.  Image 2 shows the JSON output.



Oh and .NET
Are you using the latest version of ardoJSON ?

Can you provide an eSpace which replicates this behavior? I won't be able to troubleshoot it without a way to replicate it.
I am, yes.  Let me see if I can re-create it for you.
Hi Doug,

Are you using the .Current record to call the ListAppend? Or using an auxiliary record?
Also, are you using any other extension to manipulate the list? (SortRecordlist for example)


Regards,
João Rosado
Hi Joao!

No other extension to manipulate.  The list(s) are built in an action where the .current values of 3 local variables with different structures are appended to the list.  The output from the action includes three lists, each serialized with ardo.  I hope that answers your question...let me know if more info is needed and thank you very very much!


Hello Doug,

I took a look at your eSpace (you provided me access privately) and I notice the pattern João Rosado is talking about, you are building the list by using the .Current record to append to the list.

This tends to cause this kind of issues. Please remove this pattern and use a local variable to hold the record to be appended.

You are also doing a remove of the currentrownumber which I'm not sure what's the expected value when the list is NOT being iterated. You should also look into this.
Got it!  So for every other non-developer out there:

1) Create a structure required by your final object
2) Create a RecordList of that structure type to hold the final output
3) Create a Variable of type Record with the same structure
4) Use that record through the logic and append it to the record list

Thanks for the help!!

D