Hi all,
I am building an app using SP lists that follows a workprocess, in a previous step an user will input a number of records (variable) to be created in an upcoming process step, Now I want the app to automatically to create those "X"number of records (Varholeqtty), for this I am Using this code:
If(
CountRows(datadrill) = 0,
ForAll(
Sequence(Varholqtty),
Collect(
datadrill,
Patch(
varNewLog,
{
ID: varNumber,
'Blast #': var_Blast,
'Hole #': First(ColHoleQtty).Result,
'Drill Depth': {Value: Text("0-10")}
}
)
);
If(
First(ColHoleQtty).Result = Varholqtty,
UpdateIf(
ColHoleQtty,
Result = Varholqtty,
{Result: 1}
),
UpdateIf(
ColHoleQtty,
Result < Varholqtty,
{Result: Value(Result) + 1}
)
)
);
ForAll(
Sequence(Varholqtty),
Collect(
datadrill,
Patch(
varNewLog,
{
ID: varNumber,
'Blast #': var_Blast,
'Hole #': First(ColHoleQtty).Result,
'Drill Depth': {Value: Text("10-20")}
}
)
);
If(
First(ColHoleQtty).Result = Varholqtty,
UpdateIf(
ColHoleQtty,
Result = Varholqtty,
{Result: 1}
),
UpdateIf(
ColHoleQtty,
Result < Varholqtty,
{Result: Value(Result) + 1}
)
)
)
)
I am using a collection and a ForAll function to sequence the "Hole #"records with an +1step in each one.
The records are being succesfully created on the SP list, but the app got inestable and gets stuck, I have to kill it and restart it each time.
How could I improve this code? Thanks in advance.
Juan