closed
Public

Hi, I have run into a bit of issue using nesting loops for a table search the aim is to do a simple count of specific table entries that are later used for the transferring of legitimate table data.

The search takes place in a single column for numbered entries that match a number, for my debugging simulation I have filled all the rows numbering from 1 to 20, my table design consists of the following layout:

20 rows, 10 columns (1 col with 2 embedded images),

Table height 421 cm(vertical scroll used to last 7 rows ) Width 690, cell height 30, various column widths, font Comic Sans MS 12 and using alternative colour system for rows.

The code above is executed via a button (Submit) click event that calls a custom event trigger attached to an un-used Textbox element.

When I run the simulation code below:

The actual results I am expecting here with my default data is 20 rows have correct data so count return should be 20 items are found, but this result does not happen as shown with debug messages in order from Inner loop:



This shows a found item where table row matches the Search Item (Position number) which is verified by image below:

The next 2 debug messages show a Search Item Dropout event even through it exists (item Number 7) as the Inner Loop does not complete it’s cycle:

Inner Loop prior to Dropout:



Main Outer Loop after Dropout (Row count and Position Number out of Sync):

Once the Table Search is complete the final debug result is:

Also this does not happen on the same rows all the time but will be different through each simulation debug run and the final Search Items found count maybe different as well, I have checked the HTML and found nothing out of ordinary contained within Search column just the expected Table number values I added.

I think I have a work around using Switch Branching instead of Nested Loop (have not done it yet) also all other Loops (not nested) are working correctly.

Ideally I would like this to work as the next part of my possessing is to write data into another table in a pre-defined sequence (a type of bubble sort) and to accomplish this Nested looping is needed.

Thanks

4 answers

Hi Mal,

Although you have included the screenshots in the post, it is still very difficult to reproduce the issue you mentioned, since the logic is complicated and it is hard to “debug” it via the screenshots.

If you believe there is a bug in the loop implementation, the best way to show it to us is to make a simple plot file, which only has necessary details so we could easily take the plot file and see what happened. If you could make such a plot file, you could send it to support@foreui.com

BTW, did your web browser complain any Javascript error during the simulation? If any step in the inner loop meets error, it could halt the current cycle. Just a direction to think about.

#1

Hi ViVi

I am using IE 11 on win 7 64 no problems with any JavaScript errors

also I am using jre 7 my config ini file is:

[JAVA_RUNTIME_ENVIRONMENT_LOCATION]

JAVA_HOME=C:Program Files (x86)Javajre7 if any help.

I will try and reproduce in another plot but will take a little time to get set up.

Thanks

#2

Hi ViVi

Just posted up a demo plot file with the issue replicated on my system.

I am very interested if results can be replicated on your system(s) as I know debugging can be a funny business.

#3

Thought I would add a reply to this topic. Big thanks to ViVi for providing the solution to this problem.

So I thought I would share with anyone who has had or having a similar issue.

The issue was caused by my use of the Delay flow control within the Loop process (refer to code at top of this topic) which was impacting the Nested Inner Loop process and terminating before completing its cycle.

Solution was to remove Delay from Loops.

#4
  1. Thanks for sharing. I would like to explain a little bit to others: because of the limitation from Javascript, the Delay is implemented with the setTimeout() function. So if you put multiple Delays in the same level, the tasks under the Delays will become parallel in the simulation. This could cause unexpected behavior if those parallel tasks are accessing to the same resource.

    The best practices is to avoid using multiple Delays in the same level. In the major of cases, you don't need to do so.

This question is now closed