Hi,
Any help is greatly appreciate it.
I have create the following patch (I need to insert records from PowerApps to Sharepoint list) and it works perfectly.
Payments = collection
SPAPLICACIONES = Sharepoint list (table B)
DOCDETALLE = form with input to table A in Sharepoint
ForAll(Payments, If(!IsBlank(Comprobante), Patch(SPAPLICACIONES,{COMPROBANTE: Comprobante, MONTO_APLICADO: Monto_Aplicado, MONTO_TOTAL: Monto_Total, MONEDA: Moneda, TIPO: Tipo, PAGO: Pago})))
However, when I add just a couple of changes to the patch formula as they are underlying below, it does not run. I have also added the changes individually but it does not run neither. It worth mentioning that the reason why I am adding the second underlying section is because I am trying to write a link between Table A and Table B, however I have not done any "Last Submit" (any advise here to replace the "Last Submit")
ForAll(Payments, If(!IsBlank(Comprobante), Patch(SPAPLICACIONES, Defaults(SPAPLICACIONES), {COMPROBANTE: Comprobante, MONTO_APLICADO: Monto_Aplicado, MONTO_TOTAL: Monto_Total, MONEDA: Moneda, TIPO: Tipo, PAGO: Pago, CPID: DOCDETALLE.LastSubmit.ID})))
Thank you in advance
I will leave you will @v-xida-msft here.
I am sorry my efforts have not reached the result you require.
Hey Kris,
Would it be possible to go for a quick call?
Thank you.
Hi @bolandre92 ,
Yes but it will have a name in the data and also a form does not have a Selected property - that can only belong to a control or gallery.
Let's get back to basics - can you please send you Patch code that you have included the CPID in - also what is the Item property of the form DOCDETALLE
Hi @bolandre92 ,
Based on the formula you provided, I think there is something wrong with it. There is no Selected property supported under the Edit from, so you could not use the DOCDETALLE.Selected.ID formula within your Patch function.
If the Item property of the DOCDETALLE Edit form is set to a LookUp formula, you could apply same LookUp formula logic within your Patch function as well, and then you could reference the ID column value under the LookUp formula result:
ForAll(
Payments,
If(
!IsBlank(Comprobante),
Patch(
SPAPLICACIONES,
Defaults(SPAPLICACIONES),
{
COMPROBANTE: Comprobante,
MONTO_APLICADO: Monto_Aplicado,
MONTO_TOTAL: Monto_Total,
MONEDA: Moneda,
TIPO: Tipo,
PAGO: Pago,
CPID: LookUp(SPDOCUMENTOSCP, PrimaryColumn = "Specific Value xxxx").ID // Please understand the LookUp formula here
}
)
)
)
Note: The LookUp(SPDOCUMENTOSCP, PrimaryColumn = "Specific Value xxxx") formula represents the LookUp formula you typed within the Item property of the DOCDETALLE Edit from.
If the Item property of the DOCDETALLE Edit from is bind to Gallery Selected Item, please assign the following formula to the CPID filed in above Patch formula:
Gallery1.Selected.ID
If you still could not understand this solution, I think maybe a quick call could help your scenario better.
Best regards,
Hi Warren,
This is how the Patch looks like:
ForAll(Payments, If(!IsBlank(Comprobante), Patch(SPAPLICACIONES,{COMPROBANTE: Comprobante, MONTO_APLICADO: Monto_Aplicado, MONTO_TOTAL: Monto_Total, MONEDA: Moneda, TIPO: Tipo, PAGO: Pago, CPID: DOCDETALLE.Selected.ID})))
I also got these two error in case they give us a hint:
1. The type of this argument 'CPID' does not match the expected type 'Record'. Found type 'error'
2. The function Patch has some invalid arguments
Hi @bolandre92 ,
Yes you are close - what did you call the CPID in the Patch?
These videos are very useful, I have already used them for this project, however, I still stuck. =(
Thks.
Hi,
Yes I have tried, I think I am very close.
I have inserted the CPID clomun as CPID: 0 in the collections as @WarrenBelz mentioned, therefore, I have also included the CPID section in the Patch as you mentioned in your earlier message but I still have an error in the formula which is underlying below:
ForAll(Payments, If(!IsBlank(Comprobante), Patch(SPAPLICACIONES,{COMPROBANTE: Comprobante, MONTO_APLICADO: Monto_Aplicado, MONTO_TOTAL: Monto_Total, MONEDA: Moneda, TIPO: Tipo, PAGO: Pago, CPID: DOCDETALLE.Selected.ID})))
Thank you.
Hi @bolandre92 ,
Have you taken a try with the solution I provided above? Is it helpful in your scenario?
Please consider take a try with the above solution I provided, then check if the issue is solved. Based on the needs that you mentioned, I think the following video would help in your scenario:
https://www.youtube.com/watch?v=xgznk4XlPCo&t=839s
https://www.youtube.com/watch?v=DylxsXIUyDc&t=17s
https://www.youtube.com/watch?v=HUX_0AA4-Hs&t=1s
Best regards,
Hi @bolandre92
Answer to question 1 is definitely Yes
When you say it should not be a text input, this can be easily converted to a number with the Value() function. So if you had the CPID as text in a collection field called CPIDNo, you would simply Patch Value(CPIDNo) - is this what you are meaning? If so you do not need the LastSubmit() reference. If it is always the same number, I assume including it in the Collection will do the same.
Am I correct in the assumptions above?