PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Suffix number to a variable
Suffix number to a variable
Iniciado por Michel VERHEYEN, 21,abr. 2020 20:35 - 5 respuestas
Miembro registrado
10 mensajes
Publicado el 21,abril 2020 - 20:35
Hi,

I'm new in WINDEV and i hope someone can help me.

I use the code mentioned below in 4 places in my application.
The Internal Window + Combo can be :
IW_Wassen1.COMBO_Programma
IW_Wassen2.COMBO_Programma
IW_Wassen3.COMBO_Programma
IW_Wassen4.COMBO_Programma

i is int
ListDeleteAll(IW_Wassen1.COMBO_Programma)
FOR i = 1 TO IW_Wassen1.COMBO_TblMachines.COL_Aantal
ListAdd(IW_Wassen1.COMBO_Programma,i)
END

I would like to put this code in a global procedure like the code mentioned below, but it doesn't work and i call it with
"vulprogramma(1)".


PROCEDURE VulProgramma(nr is int)
ListDeleteAll(IW_Wassen[nr].COMBO_Programma)
FOR i = 1 TO IW_Wassen[nr].COMBO_TblMachines.COL_Aantal
ListAdd(IW_Wassen[nr].COMBO_Programma,i)
END

tx in advance
Miembro registrado
62 mensajes
Publicado el 23,abril 2020 - 09:36
Hi Michel,
you have to use "indirection"
https://help.windev.com/en-US/…


PROCEDURE VulProgramma(nr is int)

myIW is string="IW_Wassen"+nr
ListDeleteAll({myIW}.COMBO_Programma)
...

Ciao
Andrea
Miembro registrado
10 mensajes
Publicado el 23,abril 2020 - 19:32
Tx Andrea
Publicado el 25,abril 2020 - 09:44
I was looking for this solution since long time.
It's really helpful for me.

From
Aruhi
Developer Salesforce
https://www.crsinfosolutions.com/salesforce-training-online/
https://www.crsinfosolutions.com/salesforce-training-mumbai/
Miembro registrado
124 mensajes
Publicado el 18,junio 2020 - 19:02
Hi Michel and Aruhi,

Don't forget to specify the type of indirection you'ld like to use. This will speed up the runtime to resolve the indirection faster.
In this case it concerns a control (ComboBox) it seems. If you use indirection to a very large extent like I do in most of my classes, the performance increase by specifying the type is noticeable.

So add "indControl" to the indirection here (https://doc.windev.com/en-US/…)
myIW is string="IW_Wassen"+nr
ListDeleteAll({myIW, indControl}.COMBO_Programma)
...


--
Best Regards - Met vriendelijke groeten - Cordialement
Peter Holemans
http://www.mcs2.eu
http://www.pixontri.eu
Publicado el 19,junio 2020 - 14:49
If you really want to go faster, then DON'T use indirections where they are not needed...

Most list, table and such functions accept STRINGS as parameters...
This means that
ListDelete(MyList1, 5) and ListDelete("MyList1",5) are BOTH accepted (in fact, historically, the "MyList1" is the original syntax)

And that, in turn, means that you can just do ListDelete("MyList"+iIndex, 5) and it will work WITHOUT having to go through the indirection system, which is much faster.

Use indirections only when you need to access the content, attributes and properties of objects.