Platform
Learn
Community
Support
Partner Center
Sign up
or
Log in
logout
Account Settings
Profile
messages
Messages
logout
Logout
Platform
Home
Downloads
IPP
Licensing
Project Sizing
Learn
Training
Documentation
Evaluation Guide
What's New
Community
Home
Forums
Forge
Ideas
Members
Support
Partner Guide
Resources Library
Opportunities
Account Management
Sign up
or
Log in
Home
Forums
Forge
Ideas
Members
Dear ,
What would improve your OutSystems Community experience? Let us know by taking this 2-minute survey.
Pick up the survey
Community
›
Forums
›
Technology & Integration
First List element is getting replaced by last list element
Community
›
Forums
›
Technology & Integration
First List element is getting replaced by last list element
New Post
New Post
Suraj Borade
Posted on 2016-03-07
Suraj Borade
Rank: #47
Posted on 2016-03-07
Hello,
I am preparing one record list by appending values from the result of "String_Split" function.
I am passing that RecordList to "RecordListToXML" control.
I am geting XML with correct no of nodes but what I see inside XML is last node's contents matches with first node and first node is not there at all i.e my first element is getting replaced by last element.
Here is an example :
<trans-unit>
<id>4</id>
<ctype>lb</ctype>
<recordvalue>• Garantie und technische Hotline</recordvalue>
</trans-unit>
<trans-unit>
<id>2</id>
<ctype>lb</ctype>
<recordvalue>• LogitechΠWebkamera-Software auf CD
</recordvalue>
</trans-unit>
<trans-unit>
<id>3</id>
<ctype>lb</ctype>
<recordvalue>• Handbuch
2 Jahre </recordvalue>
</trans-unit>
<trans-unit>
<id>4</id>
<ctype>lb</ctype>
<recordvalue>• Garantie und technische Hotline</recordvalue>
</trans-unit>
Please advice.
Thanks and Regards,
Suraj Borade
Mário Araújo
Posted on 2016-03-07
Mário Araújo
Rank: #41
Posted on 2016-03-07
Solution
Hi there Suraj,
I believe this can be a number of things, but most likely it's something to do with the way it's coded.
Would you please isolate the issue in a module that could publish in a personal edition? People in the community can then can have a look at it and better help you :)
Cheers!
Solution
Suraj Borade
Posted on 2016-03-07
Suraj Borade
Rank: #47
Posted on 2016-03-07
Solution
XMLTest.oml
Hi Mario,
Thanks for the reply.
I have attached an OML.
Here, inside generate XML action, I am splitting string and assigning to the record list. I want to convert that record list into XML but my first element is getting replaced by last element.
Please have a look.
Thanks.
-- Suraj
Solution
Kilian Hekhuis
mvp_badge
mvp_label
Posted on 2016-03-07
Kilian Hekhuis
mvp_badge
mvp_label
Rank: #9
Posted on 2016-03-07
Solution
Hi Suraj,
You can never ever ever use the RecordList.Current in a ListAppend to the same RecordList. Ever. And yes, I do think Service Studio should signal a Warning or even an Error. Create a local variable, and assign + ListAppend that and your problems will be fixed.
Solution
Suraj Borade
Posted on 2016-03-08
Suraj Borade
Rank: #47
Posted on 2016-03-08
Solution
Good Morning Kilian sir,
Your solution perfectly worked. You really have in depth knowledge of OutSystems platform. I and my team really appreciate it.
Meanwhile I searched for documentation of ListAppend functionality but I didn't get explanation about this issue.
Will you please explain why should we avoid appending
RecordList.Current to the same RecordList?
Thanks again.
Regards,
Suraj Borade
Solution
Kilian Hekhuis
mvp_badge
mvp_label
Posted on 2016-03-08
Kilian Hekhuis
mvp_badge
mvp_label
Rank: #9
Posted on 2016-03-08
Solution
Hi Suraj,
It's one of these things that have to do with how the platform is implemented. I'm not sure why it works like that, an OutSystems engineer could probably tell us more. I just find it slightly baffling that there's no warning in the documentation or in Service Studio, as it is a common error to make.
I've created an idea
to have Service Studio give a warning or error if you try to do this. You can vote for it :).
Solution
Suraj Borade
Posted on 2016-03-08
Suraj Borade
Rank: #47
Posted on 2016-03-08
Solution
Thanks a lot sir.
I have posted my views for this idea.
Solution
J.
mvp_badge
mvp_label
Posted on 2016-03-08
J.
mvp_badge
mvp_label
Rank: #7
Posted on 2016-03-08
Solution
I'm failing to see why service studio should give a warning/error. error most definately not.
a warning I doubt, I can imagine there are use-cases for it...
Solution
Kilian Hekhuis
mvp_badge
mvp_label
Posted on 2016-03-08
Kilian Hekhuis
mvp_badge
mvp_label
Rank: #9
Posted on 2016-03-08
Solution
J.,
The reason why Service Studio should warn is that it's something that seems very intuitive to do, but doesn't work (it has never worked). Every newbie falls in this trap. ListAppending the Current of the recordlist you're appending to fails (or rather, leads to unexpected/unpredictable) results. You don't think the platform should warn you when you're trying to do something that doesn't work?
Solution
J.
mvp_badge
mvp_label
Posted on 2016-03-08
J.
mvp_badge
mvp_label
Rank: #7
Posted on 2016-03-08
Solution
I agree to disagree :)
Help:
The
ListAppend
action is a
System Action
that adds an element to the end of a list. The input list is effectively modified but the current element of this list is not changed.
Variables of List data type have a reference to the values, so don't contain a copy of the elements.
So imho, it does what it does....it adds the current, but current is never changed....
which maybe strange at first, but to me, it's logical.
Solution
Kilian Hekhuis
mvp_badge
mvp_label
Posted on 2016-03-08
Kilian Hekhuis
mvp_badge
mvp_label
Rank: #9
Posted on 2016-03-08
Solution
I see what you mean. Still, about every collegue of mine fell into this pitfall, and before that I did. I still think it's nice to give a warning :).
Solution
Quick Reply
attachment
Choose File
No file chosen
Submit
Login to reply
New Post
Available Forums
Technology & Integration
News and Announcements
Forge Discussions
Meta
Community Quick Guides
Usability
Installation Troubleshooting
Personal Environment Troubleshooting
Forum Notifications
Email Digest Settings
Loading...