Linx Main Linx Help

Cast String reference of an object to an object


I would like to know if it is possible in LINX 5 to cast a string refence of an object to an object.


List_output = {“t”,“e”,“s”,“t”}

String_Output = “List_Output[0] +List_Output[1] +List_Output[2] +List_Output[3]”

String_Final = String_Output


String_Final = “List_Output[0] +List_Output[1] +List_Output[2] +List_Output[3]”

I want to know how to cast or reference the string of objects so that String_Final would be

String_Final = “test” and not “List_Output[0] +List_Output[1] +List_Output[2] +List_Output[3]”

But it should be dynamic

Direct Reference from String Value

Hi Eduard,

Firstly, to answer your question:

No you cannot directly reference an object by a string value. The main reason is, Linx compiles your solution, and in doing that, a string “List_Output” stays a string, but an Object List_Output becomes a machine reference with a GUID code etc. So Linx will no longer know what you are referring to.

Secondly, I’d like to find out what you’re trying to achieve, as I think there are multiple easier ways than creating a string. I’ve attached an example where I’m using String Indexes to achieve your result, or any other result, based on the order of indexes given:

StringsFromListOfStrings.lsoz (3.4 KB)

Hi Dawie

Thanks for the reply.

I wanted to see if you could dynamically read different csv format files.

Kind Regards

Thanks Eddy,

Yes, we have been doing similar reads at clients. You’ll need to design your logic well.

What we normally do is, in a Database, list a CSV configuration. Which basically says: Columns Numbers, Names and Rules etc.

Then when we read the CSV file, we first read the configuration from the Database, and then read the lines from the file. The file lines then can be Split into a list, using the denominator as the splitter (i.e. “,”) By using the method I showed in the previous post, you can then read through the columns you want.

But, like I said, the complex part is the logic of understanding your variations and what you want to do with the data.