Omron Sysmac: Sort Array in HMI for selection

ekusiak

Member
Join Date
Oct 2022
Location
ky
Posts
3
Hello all,

I am attempting to sort a selection list via 'part-selection' buttons.

Ex. a certain type of model is selected, I only want to have the members of the array which match that model to be selectable.

I can move the members into a 'display' array just fine based on comparison, but I'm fuzzy on how to put those 'non-zero' array members into a selectable array in Sysmac HMI code



See For loop attached



Thanks!

Screenshot 2022-11-16 075818.png
 
Welcome to the forum.

Your description is ambiguous; more information is needed to ensure we understand what is being asked.

First of all, it looks like you are selecting elements to display, not sorting them.

It looks like your WorkDatabase is an array with fixed contents i.e. the contents do not change.

It looks like your DB_HMI_DisplayList is an array that will have variable contents, e.g. only elements of the WorkDatabase array that match a certain property (e.g. .Truck).

Both arrays have the same data type, and both have space for at most (a maximum of) 200 elements. Presumably the number of elements in the WorkDatabase will not change, but you want to vary (limit) the number of items displayed from the DB_HMI_DisplayList to the number of elements that have a certain value for a property (.Truck), even if the entire array always has a constant size (200 or more).

Is any or all of that correct?
 
Last edited:
Apologies for the loss of verbiage.

I am looking to filter/sort members of a static database array (all with the same datatype)

To do this, they will select a certain parameter corresponding with a member of the datatype (truck # for example, has 3 options) and this will list Part ID #s (member of the same datatype array) that include that truck #.

From that list, I would like to select a member of the array (from the filtered/sorted list, of part ID #s) and have it return a pointer for that original array member.

So you are correct mostly, just want to be able to select from that filtered list afterward. Is the 'display' array needed? I assumed that part.

Currently, I'm able to sort by a parameter selection, but then that leaves me with a 'display' array with a lot of 'blanks' in-between valid options. Would the best option be to only display the 'non-zero' members somehow? Then include a pointer in that datatype? (For selection purposes)
 
Code:
COUNT_OF_MATCHES := 0;

FOR J:= 0 TO 199 BY 1 DO
    IF WorkDatabase[J].Truck = DesiredTruck THEN
        DB_HMI_Display[COUNT_OF_MATCHES] := WorkDatabase[j];
        COUNT_OF_MATCHES := COUNT_OF_MATCHES + 1;
    END_IF;
END_FOR;
After that runs, the first [COUNT_OF_MATCHES] elements in the DB_HMI_DISPLAY array, i.e. DB_HMI_Display[0] through DB_HMI_Display[COUNT_OF_MATCHES - 1], will contain copies of all of the elements from the WorkDatabase array that have .Truck values equal to DesiredTruck. The rest of the array, DB_HMI_Display[COUNT_OF_MATCHES] through DB_HMI_Display[199], will have indeterminate values. So if you can use the COUNT_OF_MATCHES to tell the HMI how many of the first elements of DB_HMI_Display to display, you should be dancing.

So the non-DesiredTruck elements will be filtered out, but nothing will be sorted.
 
Right on. I appreciate that formatting solution. What would you call that other than sorting?

Also, do you know if the list box in Sysmac is dynamic in its elements displayed?
 
Right on. I appreciate that formatting solution. What would you call that other than sorting?

Also, do you know if the list box in Sysmac is dynamic in its elements displayed?


I would call it filtering.


I have never worked with the list box Sysmac, so I have no idea.
 

Similar Topics

I took an online course but don't remember covering this. How do I access the system clock in a compare instruction? I want to turn on an output...
Replies
1
Views
491
I come from an AB background. My current job has a lot of Omron devices. We have a couple systems with NX102's with numerous IO link devices...
Replies
0
Views
620
Hi everyone, I am trying to program a function block to copy the variables obtain from Ethercat into a structure on a NX1P2. Since I cannot...
Replies
1
Views
1,072
Hi everyone! I have an issue with some Omron CP1L-E PLC's. They're connected to get the info from production machines, but I've noticed that...
Replies
2
Views
1,122
Hello. I have a problem with omron sysmac cp1e controller delayed start. The controller has been working on the punch press since 2016. Recently...
Replies
1
Views
749
Back
Top Bottom