PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WB19]Indirection on Array
[WB19]Indirection on Array
Iniciado por guest, 19,abr. 2015 21:10 - 1 respuesta
Publicado el 19,abril 2015 - 21:10
Hi

I have an array created by means of FiletoArray. I want to export some of the fields, based on a list of fields the user added to a ListBox.

So I run through the elements in the listbox for each row of the array and store the currently selected item in the listbox to my variable sFieldname.

DocumentsArray.sFieldname is the value that I want but how to use indirection on this please?

I have tried

{"DocumentsArray"+"."+sfieldName} and all variations thereof without success.

Thanks in advance.


Ericus Steyn
Publicado el 19,abril 2015 - 21:22
Hello Ericus

This is the simplest way to find out what the right syntax is:

type in the correct syntax WITHOUT indirection, for one of the real cases and verify that it works

by example (i'm typing without verifying anything here):
DocumentsArray.CompanyName[1]
if that is the correct syntax, you then place it inside the indirection:
{DocumentsArray.CompanyName}[1]
You add the qualifier, depending of the type of object you are working on
{DocumentsArray.CompanyName, indvariable}[1]
and then you replace the example value by the variable(s) that will contain this value
{"DocumentsArray."+sFieldName, indvariable}[1]

at this point -IF- the original line WAS WORKING and -IF- the string built by the variable CONTAINS THE RIGHT VALUE, then you have your syntax

Best regards