Autofeed select

I have created a function in a select but actually want the function to be different. I am now searching on wd for the weld data but actually want to search on welddata so that I can include all the weld data not only the welddata that are defined like wd.

Appstudio code:

const module = “mRW_GoFaData”;
const task = “T_ROB1”;
const result = ;

for (let i = 1; i <= 100; i++) {
const name = “wd” + i;
try {
const type = await API.RAPID.getVariableType(module, name, task);
if (type === “welddata”) {
result.push(${name}|${name});
}
} catch (e) {
// Variabele bestaat niet, doorgaan
}
}

this.optionItems = result.join(“;”);

Rapid code:
!---------------- Welddata -------------------
PERS welddata wd1:= [12,7.5,[1.7,3.1,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]];
PERS welddata wd2:= [9.5,1.6,[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]];
PERS welddata wd3:= [5,0,[0,0,0,100,0,0,0,0,0,0],[0,0,0,100,0,0,0,0,0,0]];
PERS welddata wd4:= [5,0,[0,0,0,100,0,0,0,0,0,0],[0,0,0,100,0,0,0,0,0,0]];
PERS welddata wd5:= [5,0,[0,0,0,100,0,0,0,0,0,0],[0,0,0,100,0,0,0,0,0,0]];
PERS welddata wd6:= [5,0,[0,0,0,100,0,0,0,0,0,0],[0,0,0,100,0,0,0,0,0,0]];
PERS welddata wd7:= [5,0,[0,0,0,100,0,0,0,0,0,0],[0,0,0,100,0,0,0,0,0,0]];
PERS welddata wd8:= [5,0,[0,0,0,100,0,0,0,0,0,0],[0,0,0,100,0,0,0,0,0,0]];
PERS welddata wd9:= [5,0,[0,0,0,100,0,0,0,0,0,0],[0,0,0,100,0,0,0,0,0,0]];
PERS welddata wd10:=[5,0,[0,0,0,100,0,0,0,0,0,0],[0,0,0,100,0,0,0,0,0,0]];
PERS welddata wd60:=[5,0,[0,0,0,100,0,0,0,0,0,0],[0,0,0,100,0,0,0,0,0,0]];

PERS welddata test123:=[5,0,[0,0,0,100,0,0,0,0,0,0],[0,0,0,100,0,0,0,0,0,0]];
PERS welddata teste123:=[5,0,[0,0,0,100,0,0,0,0,0,0],[0,0,0,100,0,0,0,0,0,0]];

Hallo, I do not have an idea for AppStudio but you might use SetDataSearch/GetDataVal from Rapid.
You can use for all welddata(or any other type) and do some restrictions for the specific name etc.
matti

is it possible to create a process in rapid that puts all the welding data in an array regardless of the name?

Hallo, DataSearch is to find all variables of a certain type in a module/task/controller.
An array is a declaration, so it can’t be done during Rapid-execution.
But you can declare an empty array and assign with what you have found with DataSearch, I think.

To make an array of record-like structures like welddata or robtarget has the disadvantage, that you can’t pick components from that structures in the the data-window on flex-pendant easily.

matti

Hi …
Jur148 …
Wouldn’t a RECORD solve your problem??

    RECORD objectWd
        string name;
        num index;
        welddata wd;
    ENDRECOR
PERS objectWd wd{2}:=[['wd1',1,[12,7.5,[1.7,3.1,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]],['wd2',2,[12,7.5,[1.7,3.1,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]]];

Good Job