Goodnight all,
Please I'm also trying to patch a collection in a search box but it really doesn't finish;
My code:
If(
!IsBlank(DataCardValue128),
If(
Form6.Mode = FormMode.New,
ForAll(
DemandeAchatActifCollection,
Patch(
DemandeAchatActif,
Defaults(DemandeAchatActif),
{
ActifId:
{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id:ActifCollectionId,
Value:ActifCollection
},
DemandeAchatId:
{
Id: Form1_10.LastSubmit.DemandeAchatId,
Value:Form1_10.LastSubmit.Code
}
}
)
);
);
Form6.Updates; NewForm(Form6)
);
the error is located here please:
ActifId:
{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id:ActifCollectionId,
Value:ActifCollection
},
Error message : the liste item could not be inserted or updated because invalid lookup values were found for the following fields in the list
Please help Me
Solved! Go to Solution.
Thank you @WarrenBelz
ActifId: LookUp(Choices([@DemandeAchatActif].ActifId),Value = ActifCollection),
I just found the magic solution with this piece of code
thank you really
Hi @Hardy299 ,
Firstly you do not need the odata reference line any more, but where are you getting ActifCollectionId and ActifCollection from?
Thank you ! @WarrenBelz
initially I have a collection that allows me to save the Actif
My code :
Collect(DemandeAchatActifCollection, {ActifCollection:DataCardValue128.Selected.Value, ActifCollectionId : CountRows(DemandeAchatActifCollection)+1})
I load my collection then I persist them in an SP list with the code:
ActifId:
{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id:ActifCollectionId,
Value:ActifCollection
},
Hi @Hardy299 ,
That is not going to work - the Id of a Lookup column is the ID of the item you have selected in the other list being looked up and you need that value to patch back to the first list. If the Items of DataCardValue128 are simply
Choices(DemandeAchatActif.ActifId)
then your Patch code would be
ActifId:
{
Value:DataCardValue128.Selected.Value,
Id:DataCardValue128.Selected.Id
}
)
Is this the case?
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
I understand but the concern is that in the list "RequestPurchaseActive", I have the ID of the RequestPurchase and the Id of the Active.
on the same screen I have the "DemandeAchatActif" creation form and the Actif creation form
the collection therefore allows me to select several Actifs, add it to a collection and then submit and press the "submit" button from where this code:
SubmitForm(Form1_10);
If(
!IsBlank(DataCardValue130) && !IsBlank(DataCardValue132),
If(
Form5.Mode = FormMode.New,
ForAll(
DemandeAchatArticleCollection,
Collect(
DemandeAchatArticleFournisseur,
{
CodeArticle: ArticleCollection,
Quantite: QteCollection,
Prix: PrixCollection,
DemandeAchatId:
{
Id: Form1_10.LastSubmit.ID,
Value:Form1_10.LastSubmit.CodeDa
}
}
)
);
);
Form5.Updates;NewForm(Form5)
);
If(
!IsBlank(DataCardValue128),
If(
Form6.Mode = FormMode.New,
ForAll(
DemandeAchatActifCollection As DD,
Patch(
DemandeAchatActif,
Defaults(DemandeAchatActif),
{
ActifId:
{
Id:DD.ActifCollectionId,
Value:DD.ActifCollection
},
DemandeAchatId:
{
Id: Form1_10.LastSubmit.DemandeAchatId,
Value:Form1_10.LastSubmit.Code
}
}
)
);
);
Form6.Updates;NewForm(Form6)
/*SubmitForm(Form6)*/
);
/*ValidationDABTL.Run("ext.paulin.pessokho@bollore.com",Office365Users.MyProfile().Mail,DataCardValue123.Text);*/
Notify(
"Opération reussie",
NotificationType.Success
);
UpdateContext({modalGroupEntiteVisibility: false})
Once the user clicks on the "submit" button, the program retrieves the current DemandeAchat Id and associates it with each asset line from the collection.
The question you posted was patching to a lookup column and the code you posted was
ActifId:
{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id:ActifCollectionId,
Value:ActifCollection
}
with the Id being
ActifCollectionId : CountRows(DemandeAchatActifCollection)+1})
This is clearly not the Id of the looked up item (it is the number of rows in a collection), which is why I suggested you may have it in the Items of the drop-down. It needs to be the ID of the item in the other list you are looking up.
You have now posted different code
ActifId:
{
Id:DD.ActifCollectionId,
Value:DD.ActifCollection
}
which I still do not believe will get the value you need.
As a related matter, please ask yourself why you are using lookup columns in the first place with Power Apps - they are unnecessary and will cause you unwanted complications compared with doing the Lookup in Power Apps and writing back to a Text field.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Thank you @WarrenBelz
ActifId: LookUp(Choices([@DemandeAchatActif].ActifId),Value = ActifCollection),
I just found the magic solution with this piece of code
thank you really
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
194 | |
95 | |
63 | |
61 | |
58 |
User | Count |
---|---|
245 | |
165 | |
91 | |
76 | |
76 |