cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AnVt44
Helper II
Helper II

Loop in canvas app

Hi everyone, sorry for disturb but i have a problem with the creation of loops.

I need to create orders con some fields: my idea is to create a loop where for each  LineNo I post the fields.

My idea is:

'for each rows in my collection, i post the fields in business central with my connector, but one fields is LineNo, which change (first row has LineNo=10000, second row =20000, ecc..)'.

I don't know how to loop this, can you please help me?

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
AnVt44
Helper II
Helper II

Hi everyone i fix my problem, if you wanna know how let me know.

Thank you

Best regards

View solution in original post

7 REPLIES 7
max81
Impactful Individual
Impactful Individual

Check the formulas 

 

* ForAll

* Sequence

 

With that you can create loops etc.

 

// If this post has helped you, I'm happy if you give me a thump up.
// If this post has helped you to solve your problem, please mark it as "solution"

 

AnVt44
Helper II
Helper II

Hi @max81, thank you! I try but i don't know how to combine this two function.

If you have time, can you please teach me how to do it?

Thank you

v-yujincui-msft
Community Support
Community Support

Hi @AnVt44 ,

 

I have made a simple test using collection for your reference.

vyujincuimsft_0-1658826517616.png

ForAll(collectionname,Patch(datasource,Defaults(datasource),
{LineNo:If(IsBlank(Last(datasource).LineNo),10000,Sum(Value(Last(datasource).LineNo),10000)),
datasourcecolumnname1:collectioncolumnname1,datasourcecolumnname2:collectioncolumnname2}))

vyujincuimsft_1-1658827275829.png

 

 

Best Regards,
Charlie Choi

AnVt44
Helper II
Helper II

Hi @v-yujincui-msft thank you for the answer! I try but i have the error :"The call of test.PostCorpoRichAcqu doesn't work:{"erroe":{"code":"Internal_RecordNotFound","message":"standard text doesn't exist. Fields and key: Item='#number of an item'.

My function is:

ForAll(
collRigheOrdine;//my collection
test.PostCorpoRichAcqu( //an action of my custom connector (Post my purchase line in a Purchase Request Management)
vartenant;
varenviroment;
varcompany;
{
LineNo: If(
IsBlank(
Last(
test.GetCorpoRichiAcqu( //Get my purchase line in a Purchase Request Management
vartenant;
varenviroment;
varcompany
).value
).LineNo
);
10000;
Sum(
Value(
Last(
test.GetCorpoRichiAcqu(
vartenant;
varenviroment;
varcompany
).value
).LineNo
);
10000
)
);
TZSIQuantityRequest: Quantità; //i try to fill the parameters of Business central with my collection's data
DocumentNo: UltimaTestaRDA.Text;
No: No;
DocumentType:"Offerta"
}
)
)

I don't know why i have this error.

v-yujincui-msft
Community Support
Community Support

Hi @AnVt44 ,

 

Sorry, I'm not really sure if the problem is datatype related, but maybe you could try a different datatype.

 

ForAll(collectionname,Patch(datasource,Defaults(datasource),
{LineNo:If(IsBlank(Last(datasource).LineNo),"10000",Text(Sum(Value(Last(datasource).LineNo),10000))),
datasourcecolumnname1:collectioncolumnname1,datasourcecolumnname2:collectioncolumnname2}))

 

 

Best Regards,
Charlie Choi

AnVt44
Helper II
Helper II

Hi @v-yujincui-msft i've tryied but it doesn't work. But thank you so much!

AnVt44
Helper II
Helper II

Hi everyone i fix my problem, if you wanna know how let me know.

Thank you

Best regards

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (2,250)