Dave Posted June 13, 2023 Report Share Posted June 13, 2023 Can someone help me out to understand how to use the Lists feature found in the solution explorer. I don't see anything in the help files. I can see that there are many types of Lists available, and I can easily create Lists, but I don't see where/how to actually use or reference the List(s), once created. Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted June 13, 2023 MVP 2023 Report Share Posted June 13, 2023 I didn't know about this one, so I went digging. There are so many hidden nuggets in UniLogic! There is some information about Lists in the Help under "For" Loops, specifically as an input argument in the "For Each" function block. I couldn't find an example on them. Any input from the Creators on how this works? Joe T. Link to comment Share on other sites More sharing options...
curtharrington1 Posted June 13, 2023 Report Share Posted June 13, 2023 The lists are used for the new "for each" loop features: search for "Loop functions" in the help files for info Link to comment Share on other sites More sharing options...
curtharrington1 Posted June 13, 2023 Report Share Posted June 13, 2023 13 minutes ago, Joe Tauser said: I didn't know about this one, so I went digging. There are so many hidden nuggets in UniLogic! There is some information about Lists in the Help under "For" Loops, specifically as an input argument in the "For Each" function block. I couldn't find an example on them. Any input from the Creators on how this works? Joe T. You can use lists as an argument for the "for each" loop without having to manage the max iterations of a typical for loop. Here is a quick example of the for each with a list: Current Item tag is a local tag similar to this C example: bool list[10]; int PE_Active = 0; // INT16 in UniLogic for (int index = 0, index <= MAX_INDEX; index++){ if(list[index] == true){ PE_Active += PE_Active + 1; } } Link to comment Share on other sites More sharing options...
Dave Posted June 13, 2023 Author Report Share Posted June 13, 2023 OK. thanks. This brings up a new topic now...Combo Box list of text source I was hoping I could utilize the "Lists" with combo boxes somehow...I would like to have the "Options: List" collection of a combo box be sourced from a dynamic list, or data table column of strings. Currently, the list for the combo box is fixed and can't be changed thru program code or operator entry. I wonder if it's possible to somehow link a data table column of strings, or a list of strings to a Combo Box or "List of Text Variable" Link to comment Share on other sites More sharing options...
Rivka Posted June 14, 2023 Report Share Posted June 14, 2023 Thank you @curtharrington1 for clarifying the feature. It is indeed a new feature that was introduced, along with the "for" and "while" loops. It is worth having a look at them! About the feature request on the dynamic combobox, that could be a nice feature. I'll open a feature request on it. Have a good day! Rivka Link to comment Share on other sites More sharing options...
Rivka Posted August 7, 2023 Report Share Posted August 7, 2023 Dear @Dave, Your request had been added to the roadmap! (will probably appear in UniLogic 1.35) Thanks for the proposition! Rivka Link to comment Share on other sites More sharing options...
MatthewO Posted May 24 Report Share Posted May 24 Hi @Rivka, Was this feature implemented on Unilogic 1.35 as the "Path (Const)" on the Combo Box properties? If so is there a way to read a specific row/column from the data table? I've referenced the csv table in general but have just got a blank selection as I am unsure how to reference a specific row. I'm trying to create a list of "live" recipe names in a combo box to allow the user to select a recipe to load to the PLC. Thanks Link to comment Share on other sites More sharing options...
Saragani Posted June 2 Report Share Posted June 2 Hi @MatthewO, No, it was not implemented in 1.35. We started implementing it, and it will probably be in 1.38 However, instead of linking it to a list or a data table, the user will be able to add string tags to a dynamic combo box (just like adding texts to regular combo box), and the combo box will show the value of the string tags. 1 Link to comment Share on other sites More sharing options...
kvlada Posted June 15 Report Share Posted June 15 Is there a way of using "Load from Array" or "Store in Array" functions with Lists? It would be awesome to make a list of structs dedicated to objects (lamps, motors, belt conveyors, robot cells...). Servicing all of them would be possible with a simple For-loop instead of a For-each. Sometimes when there's lots of objects, to save on retained memory I make two structs for an object: one containing retained settings and one containing non-retained variables for the object which are reset to zero on power-on. I do this is because I can't pick which variables in a struct will be retained, and which would not. Only the whole struct can be marked as retained. That would be a huge waste of precious retained 256K. Problem arises when using For-each: the loop can only take ONE type of struct, not two. So the variables struct can't see the settings struct. Link to comment Share on other sites More sharing options...
Saragani Posted July 22 Report Share Posted July 22 Well, for now, the dynamic combo box development is being delayed for later versions, but it is still on our plan. Link to comment Share on other sites More sharing options...
ORSO2001 Posted July 22 Report Share Posted July 22 On 6/15/2024 at 2:24 PM, kvlada said: Is there a way of using "Load from Array" or "Store in Array" functions with Lists? It would be awesome to make a list of structs dedicated to objects (lamps, motors, belt conveyors, robot cells...). Servicing all of them would be possible with a simple For-loop instead of a For-each. Sometimes when there's lots of objects, to save on retained memory I make two structs for an object: one containing retained settings and one containing non-retained variables for the object which are reset to zero on power-on. I do this is because I can't pick which variables in a struct will be retained, and which would not. Only the whole struct can be marked as retained. That would be a huge waste of precious retained 256K. Problem arises when using For-each: the loop can only take ONE type of struct, not two. So the variables struct can't see the settings struct. Hi Kvlada, if the values that must be retained don't change really fast you can consider to save it in a file...so...you can upload the info from the file at each boot of the system...this means that an SD must be present but this will also guarantee that all info will be recover and a new PLC could run really quickly in case of replacement. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now