Create an Array from a dynamic Choice field
I want to create one row for every choice selected in the DCF.
I wrote this code and something don't work.
let a := numbers('ISTRUTTORI.');
let aa := 'ISTRUTTORI.';
let b := PERIODO;
let c := 'Nome della campagna';
let d := 'COSTO A TESTA';
let e := this.ID;
let z := (create 'COMPETENZA ISTRUTTORI');
for loop in aa do
z.(ISTRUTTORE := first(a));
z.('PERIODO-MESE' := b);
z.(CAMPAGNA := c);
z.(IMPORTO := d);
z.('GDMI - [ADS] REPORT-COSTO-PRESTAZIONI' := e)
end;
z
The first() command is because Ninox assistant give me an alert tell me about multiple values is a problem.
I don't find the way to give this a loop/array to give every choice a new row in the linked table
2 replies
-
You are very close.
Since you have var a, you don't need var aa.
You need to reference your loop variable that references the ISTRUTTORE record that you selected in ISTRUTTORI.
I'm guessing you want to create a record in COMPETENZA ISTRUTTORI for each selection in ISTRUTTORI. That means the create() has to be inside the for loop structure. You can also simplify the reference to var z by using the parentheses.
The following changes should get you closer to what I think you want.
let a := numbers('ISTRUTTORI.'); let b := PERIODO; let c := 'Nome della campagna'; let d := 'COSTO A TESTA'; let e := this.ID; for loop in a do let z := (create 'COMPETENZA ISTRUTTORI'); z.( ISTRUTTORE := loop; 'PERIODO-MESE' := b; CAMPAGNA := c; IMPORTO := d; 'GDMI - [ADS] REPORT-COSTO-PRESTAZIONI' := e )
Content aside
- Status Answered
- 2 days agoLast active
- 2Replies
- 14Views
-
2
Following