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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Collecting gallery dat...
Power Apps
Answered

Collecting gallery data with Text input fields

(0) ShareShare
ReportReport
Posted on by

Hi all. Need some help programming the Collect function.

I have used the following guide:

https://powerusers.microsoft.com/t5/Building-Power-Apps/Saving-all-data-from-Text-Input-fields-within-a-Gallery/td-p/620713

 

Below is my code:

Collect(Internordre;

    ForAll('Gallery-Gen-ord'.AllItems;

        {

            OrdNo:Value('GenOrd-Body-OrdNr'.Text);

            ProdNo:'GenOrd-Body-Prodno'.Text;

            TrInf3:'GenOrd-Body-TilInfo'.Text;

            Descr:'GenOrd-Body-Beskr'.Text;

            NoInvoAb:'GenOrd-Body-Ant'.Text;

            BestAv:'GenOrd-Body_BestAv'.Text

        }));

UpdateContext({ResetItems:true})

 

My problem is that I get an error message (see marked area in the code).

The error message reads as follows: «A field named Descr was specified more than once in this record». I have now changed the name of the textinput field, but the error message remains.

How can I collect data from gallery that also has textinput fields?

Your help would be highly valued

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at

    Hi @Anonymous ,

    Firstly try this - I have to assume here that all of those Text controls are in the gallery

    Collect(
     Internordre;
     ForAll(
     'Gallery-Gen-ord'.AllItems As _Data;
     {
     OrdNo: Value(_Data.'GenOrd-Body-OrdNr'.Text);
     ProdNo: _Data.'GenOrd-Body-Prodno'.Text;
     TrInf3: _Data.'GenOrd-Body-TilInfo'.Text;
     Descr: _Data.'GenOrd-Body-Beskr'.Text;
     NoInvoAb: _Data.'GenOrd-Body-Ant'.Text;
     BestAv: _Data.'GenOrd-Body_BestAv'.Text
     }
     )
    );;
    UpdateContext({ResetItems:true})

     

    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

  • Community Power Platform Member Profile Picture
    on at

    @WarrenBelz - That is correct assumed.

    I still get the same error, and it also do not like the semicolon at the end of the code

     

    Engalpengal2009_0-1708600034402.png

    It says "Unexpected character. The character is used in the formula in an inexpected way.

  • Community Power Platform Member Profile Picture
    on at

    I forgot to mention. The fields in the gallery that is textinputfields are:

    GenOrd-Body-TilInfo

    GenOrd-Body-Ant

    Rest is Textboxes that gets info from a sharepoint list

     

  • WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at

    @Anonymous ,.

    Firstly see correction - getting brain into gear typing European syntax was a bit slow (you need ;;)

    Also what type of control is 'GenOrd-Body-Beskr' and what type of field is Desc ?

  • Community Power Platform Member Profile Picture
    on at

    My bad, i should know better, now there are two semi colon 🙂
    'GenOrd-Body-Beskr' is a textbox item - ThisItem.Descr

    Descr is a column in a SP list called BomEN

     

    In the App, i have 2 gallerys

     

    One called Gallery-Best-Varesort -

    And works like a product register with sorting options

    It shows data from a SP list called BomEN

    This gallery also has diferent type of filters to reduce amount of data in the gallery

    There is also checkboxes for selection of items in this gallery

     

    The  second gallery is called Gallery-Gen-Ord

    And is ment for generating an production order.

    It lists checked Items from previously mentioned gallery.

    There is a Textbox that generates a serialnumber, and two text input fields. One for adding amount and one for additional information.

     

    Under is a printscreen of the app with descriptions. Its messy, but perhaps it is helpful

    Engalpengal2009_0-1708610252639.png

     

     

  • WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at

    Hi @Anonymous ,

    There are only two things we need to know here - firstly you are saying that desc is a Single Line of Text field (I assume you are using SharePoint here)  and that 'GenOrd-Body-Beskr'  is a Text input - is this Modern or Classic ? Which one is it on your screenshot ?

  • Community Power Platform Member Profile Picture
    on at

    firstly you are saying that descr is a Single Line of Text field (I assume you are using SharePoint here)

    - Yes, the SP list is called BomEN

    'GenOrd-Body-Beskr'  is a Text input

    - Yes, but i do not the difference between Modern or Classic. I just selected the alternative in the menu. See Pic.

    Which one is it on your screenshot ?

    See Pic 2 and 3. Both gallery shows Descr

     

    Engalpengal2009_0-1708674636975.png 

    Engalpengal2009_1-1708674668288.png 

    Engalpengal2009_2-1708674692012.png

     

     

     

  • WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at

    @Anonymous 

    Have you got one Modern Control in amongst all the other Classic text boxes ? If so you need 

    'GenOrd-Body-Beskr'.Value

    This should be a very easy issue to solve (it just requires matching the valid output of a control with the expected data type in the data source field)

  • Community Power Platform Member Profile Picture
    on at

    Thank you very much, it works perfectly now.

    Final result:

    ClearCollect(
        Col_Int_Ord,
        ForAll(
            'Gallery-Gen-ord'.AllItems,
            {
                OrdNo: 'GenOrd-Body-OrdNr'.Text,
                ProdNo: 'GenOrd-Body-Prodno'.Text,
                TrInf3: 'GenOrd-Body-TilInfo'.Text,
                Descr: 'GenOrd-Body-Beskr'.Text,
                NoInvoAb: 'GenOrd-Body-Ant'.Text,
                BestAv: 'GenOrd-Body_BestAv'.Text
            }
        )
    )

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard