web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Only send the first it...
Power Apps
Answered

Only send the first item in my collection to my sharepoint list

(0) ShareShare
ReportReport
Posted on by 98

 

Hi all,
I need help sending only the first item in my collection to my sharepoint list.

The formula I'm using is
ForAll (CustomerDisplays; Patch (Customer_Dev_List; Defaults (Customer_Dev_List);
{code: COD_CLIENTE;
Title: RAZAO_SOCIAL;
store: LOJA_CLIENTE;
address: ENDERECO_CLIENTE;
municipality: MUNICIPIO_CLIENTE;
state: ESTADO_CLIENTE;
tipofrete: TIPO_FRETE;
codtransp: COD_TRANSPORTADORA;
transp: NAME_TRANSPORTADORA;
valornf: VALOR_BRUTO_NFE;
note: NOTE;
serie: SERIE;
IdDev: FormDevolucao.LastSubmit.ID
}))

however in my collection there are more than 1 client and I only wanted the first one.

Can anyone guide me?

Categories:
  • newk1991 Profile Picture
    91 on at

    Patch (Customer_Dev_List; Defaults (Customer_Dev_List);
    {code: First(CustomerDisplays).COD_CLIENTE;
    Title: First(CustomerDisplays).RAZAO_SOCIAL;
    store: First(CustomerDisplays).LOJA_CLIENTE;
    address: First(CustomerDisplays).ENDERECO_CLIENTE;
    municipality: First(CustomerDisplays).MUNICIPIO_CLIENTE;
    state: First(CustomerDisplays).ESTADO_CLIENTE;
    tipofrete: First(CustomerDisplays).TIPO_FRETE;
    codtransp: First(CustomerDisplays).COD_TRANSPORTADORA;
    transp: First(CustomerDisplays).NAME_TRANSPORTADORA;
    valornf: First(CustomerDisplays).VALOR_BRUTO_NFE;
    note: First(CustomerDisplays).NOTE;
    serie: First(CustomerDisplays).SERIE;
    IdDev: FormDevolucao.LastSubmit.ID
    })

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi@beatrizmoura26,

    Based on the issue that you mentioned, do you want to patch the first record of the collection to your SP list?

    Could you please share a bit more about the scenario?

    Let me make it easy for you. The ForAll() function will operate all the collection rather than a certain record. Also, the Patch() formula you wrote will surely patch all the collection.

    If you just want to patch the first record of your collection, you could try to collect the first records within the collection to a new collection.

    I have a test on my side, please take a try as below.

    Collect the first item of the previous collection to a new collection.

     

    ForAll (
     Collect(Col,First(CustomerDisplays)),
     Patch (
     Customer_Dev_List,
     Defaults (Customer_Dev_List),
     {
     code: COD_CLIENTE,
     Title: RAZAO_SOCIAL
     }
     )
    )

     

    Note: The new collection that stores the first item of your 'CustomerDisplays' collection is named 'Col'. For convenience, I just test for two fields, you could replace it with yours.

    You could modify your formula as below:

    ForAll (Collect(Col,First(CustomerDisplays)); Patch (Customer_Dev_List; Defaults (Customer_Dev_List);
    {code: COD_CLIENTE;
    Title: RAZAO_SOCIAL;
    store: LOJA_CLIENTE;
    address: ENDERECO_CLIENTE;
    municipality: MUNICIPIO_CLIENTE;
    state: ESTADO_CLIENTE;
    tipofrete: TIPO_FRETE;
    codtransp: COD_TRANSPORTADORA;
    transp: NAME_TRANSPORTADORA;
    valornf: VALOR_BRUTO_NFE;
    note: NOTE;
    serie: SERIE;
    IdDev: FormDevolucao.LastSubmit.ID
    }))

    Best Regards,

    Qi

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.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard