I'm using Xpert.ivy Designer 5.1.0 (Lauberhorn) S6. I tried to fill a List in a loop:

  1. In a form I ask the user, how many entries the list will have (numberOfIterations)
  2. With an Alternative Switch element I'm ensuring, that the following steps are executed as often as the defined number of iterations:
  3. In a form I ask the user for the attributes of the list entry (attribute one, attribute two)
  4. In three different variants I add the new list entry to the list. Only the most time consuming variant works. The other variants don't work as expected. I suppose, this is a bug.

To better understand, please watch the screencast on YouTube (2 minutes).

An answer until 25.11. evening would be very appreciated.

[EDIT]: Here the link to the iar-File for testing.

asked 22.11.2013 at 10:52

Bj%C3%B6rn's gravatar image

Björn
(suspended)
accept rate: 100%

edited 22.11.2013 at 11:16


With the input of Daniel Oechslin I was able to make a simple solution without the code element. I use the funtion deepClone to generate a new listEntry-Object each run. See the picture below. DeepClone

link

answered 22.11.2013 at 13:28

Bj%C3%B6rn's gravatar image

Björn
(suspended)
accept rate: 100%

1

Hi again a clone(); would be enough.

deepclone(); you only need in case of lists or objects relating to other object.

class Tree(){

String treeName;

List <branche> treeBranches;

}

A clone() would copy the treeName and an empty List treeBranches.

A deepClone() would copy the treeName and the List and every instance wihtin this list.

(22.11.2013 at 13:34) Daniel Oechslin Daniel%20Oechslin's gravatar image

Thanks for the clarification! Have a nice weekend.

(22.11.2013 at 13:40) Björn Bj%C3%B6rn's gravatar image

Hi Björn

Concerning your second run (Add list entry to demo list I (doesn't work)): I think the behavior you scripted is what it should be. The problem is, that you use the same 'in.demoListEntry' twice. You don't instatiate a new one before entering the new Dialog data. You should add something like:

DemoListEntry demoListEntry= new DemoListEntry();

demoListEntry.attribute1= "b";

demoListEntry.attribute2= "bb";

The same Problem should apply to you third run.

link

answered 22.11.2013 at 11:05

Daniel%20Oechslin's gravatar image

Daniel Oechslin
(suspended)
accept rate: 39%

edited 22.11.2013 at 11:06

Hi Daniel

Thanks for your answer. But I'm not fully satisfied with it: 1. Your solution would be as time consuming as the Variant III, especially if there are not only two attributes but 20. 2. It is the same object 'in.demoListEntry', but not with the same values in the two runs. 2. If your idea is correct, then I would expect, that in the result two times the first entry will be displayed (a, aa) and not the second one (b, bb).

I will add a link in my question to the iar-File so you can test yourself.

(22.11.2013 at 11:15) Björn Bj%C3%B6rn's gravatar image
1
  1. The problem is due to the fact that DemoListEntry is an Object- Java handles it by reference. If you manipulate the data in the 2nd run every DemoListEntry added before will be updated to the new values.
(22.11.2013 at 11:23) Daniel Oechslin Daniel%20Oechslin's gravatar image

This makes sense. Now I understand the reason for the behaviour. With my scenario the DemoList contains multiple times the same DemoListEntry. Thank you very much. Because of this comment I was able to make your solution even more simple (see below in a minute).

(22.11.2013 at 13:25) Björn Bj%C3%B6rn's gravatar image

Hi Björn

I added this:

import fillListInLoop.ListEntry;

in.demoListEntry= new ListEntry();

in a script step between your XOR and the Dialog (Collect attributes for one entry in the demo list)

It works fine and I don't see any extra time consuming factor. Please remember that you can disable the animation. A scriptstep animation is shown slower by Default.

The correct behavior of this Addition would be to have a result as the following:

ListEntry(attributeOne=a, attributeTwo=aa)

ListEntry(attributeOne=b, attributeTwo=bb)

Cheers to the ZHAW

elemenToList

The scheme shown in the Ivy.Designer:

Screenshot

link

answered 22.11.2013 at 11:37

Daniel%20Oechslin's gravatar image

Daniel Oechslin
(suspended)
accept rate: 39%

edited 22.11.2013 at 13:20

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×5
×3

Asked: 22.11.2013 at 10:52

Seen: 7,999 times

Last updated: 22.11.2013 at 13:40