Announcements
My formula is actually like this, i tried all solutions i can find. i want to patch an item on my SP but not a duplicate, by making a lookup before the patch, but the lookup doenst work.ForAll(Filter(QualinetGAL.AllItems; !IsBlank(CONTRATOGAL.Text));If(IsBlank(LookUp('TAP LOTADO - TP1 V2';CONTRATO = CONTRATOGAL.Text && 'DATA OC QUALINET' = DateTimeValue(DATAOCGAL.Text)).CONTRATO);Patch('TAP LOTADO - TP1 V2';Defaults('TAP LOTADO - TP1 V2');{INCIDENTE: "PREENCHER";DEFINICAO: "VALIDAR OC";CIDADE: CIDADEGAL.Text;UF: UFGAL.Text;CONTRATO: CONTRATOGAL.Text;'DATA OC QUALINET': DateTimeValue(DATAOCGAL.Text);ENDERECO: ENDERECOGAL.Text;NODE: NODEGAL.Text})));;Clear(QualinetTot);;Reset(QualinetTextos)
Hi @FaresNunes ,
Try this for a start
With( {_Date: DateTimeValue(DATAOCGAL.Text)}; With( { _New: IsBlank( LookUp( 'TAP LOTADO - TP1 V2'; CONTRATO = CONTRATOGAL.Text && 'DATA OC QUALINET' = _Date ).CONTRATO ) }, ForAll( Filter( QualinetGAL.AllItems; !IsBlank(CONTRATOGAL.Text) ) As _Data; If( _New; Patch( 'TAP LOTADO - TP1 V2'; Defaults('TAP LOTADO - TP1 V2'); { INCIDENTE: "PREENCHER"; DEFINICAO: "VALIDAR OC"; CIDADE: _Data.CIDADEGAL.Text; UF: _Data.UFGAL.Text; CONTRATO: _Data.CONTRATOGAL.Text; 'DATA OC QUALINET': _Date; ENDERECO: _Data.ENDERECOGAL.Text; NODE: _Data.NODEGAL.Text } ) ) ) ) );; Clear(QualinetTot);; Reset(QualinetTextos)
If any of those Text controls are not in the gallery, remove _Data from them.
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.
MVP (Business Applications) Visit my blog Practical Power Apps
They are all in the galley but now its returning DATAOCQUALINET is obrigatory on patch
im getting a network error, and i dont know why, the code is just like you said
i just turn off mandatory DATAOCQUALINET on SP list and then the code works, but keep patching duplicate to SP list
What i want is that for every item in my gallery i check the item CONTRATOGAL label text and DATAOCGAL label text, if they have a clone on my SP list and then if not patch the gallery item on SP, but first the lookup inst working and now it works but on some point i miss on the formula and the patch is cloning items anyway
@FaresNunes ,
I assume 'DATA OC QUALINET' is a Date field in SharePoint. Where is DATAOCGAL situated (inside or outside of the gallery), how is it populated and why do you need to convert it with DateValue ?
Yes 'DATA OC QUALINET' is a Date field in SharePoint, cause i need to calculate some Date differences in the app, but now i changed the code creating a new column on SP to control date text and compare on lookup, i read the docs and see that Date type fields are not delegable, my date is populated by a text from a sheet that i convert into Date Type to patch on SP, so i created a new field Text Type to insert the date as text, but it doenst work as well.Look at the code:With({_Date: DATAOCGAL.Text};With({_New:IsBlank(LookUp('TAP LOTADO - TP1 V2';CONTRATO = CONTRATOGAL.Text &&'CTRL DATA QUALINET' = _Date))};ForAll(Filter(QualinetGAL.AllItems;!IsBlank(CONTRATOGAL.Text)) As _Data;If(_New;Patch('TAP LOTADO - TP1 V2';Defaults('TAP LOTADO - TP1 V2');{INCIDENTE: "PREENCHER";DEFINICAO: "VALIDAR OC";CIDADE: _Data.CIDADEGAL.Text;UF: _Data.UFGAL.Text;CONTRATO: _Data.CONTRATOGAL.Text;'CTRL DATA QUALINET': DATAOCGAL.Text;'DATA OC QUALINET': DateTimeValue(DATAOCGAL.Text);ENDERECO: _Data.ENDERECOGAL.Text;NODE: _Data.NODEGAL.Text})))));;Clear(QualinetTot);;Reset(QualinetTextos)i need to compare the "CONTRATO" field and the TEXT of DATA OC QUALINET that i created a column "CTRL DATA QUALINET" to it, but the app keep patching duplicate to SP.
DATAOCGAL is inside the gallery, in a label
Firstly Dates in SharePoint are Delegable, so the conversion to Text and back is actually adding complexity you do not need. Just add a Date Picker and directly Patch the content of this. Also this piece of code
ForAll( Filter( QualinetGAL.AllItems; !IsBlank(CONTRATOGAL.Text) ) As _Data;
creates a new record for every record in the gallery Qualinet where the CONRTATOGAL control is not blank, so I suspect there is more than one record in the gallery that matches this.
The actual code is like this, if i remove the !IsBlank you think it should work? i have that to not patch any empty value on SP, but i dont think i do it the best wayWith({_Date: DateTimeValue(DATAOCGAL.Text)};With({_New: IsBlank(LookUp('TAP LOTADO - TP1 V2';CONTRATO = CONTRATOGAL.Text && 'DATA OC QUALINET' = _Date).CONTRATO)};ForAll(Filter(QualinetGAL.AllItems;!IsBlank(CONTRATOGAL.Text)) As _Data;If(_New;Patch('TAP LOTADO - TP1 V2';Defaults('TAP LOTADO - TP1 V2');{INCIDENTE: "PREENCHER";DEFINICAO: "VALIDAR";CIDADE: _Data.CIDADEGAL.Text;UF: _Data.UFGAL.Text;CONTRATO: _Data.CONTRATOGAL.Text;'DATA OC QUALINET': DateTimeValue(DATAOCGAL.Text);ENDERECO: _Data.ENDERECOGAL.Text;NODE: _Data.NODEGAL.Text})))));;Clear(QualinetTot);;Reset(QualinetTextos)
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 396 Super User 2026 Season 2
Mohsin Ali 323
WarrenBelz 193 Most Valuable Professional