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 / Getting a single cell ...
Power Apps
Unanswered

Getting a single cell out of a record, table or collection

(0) ShareShare
ReportReport
Posted on by 52

Hey,

 

Just getting started with Powerapps but searching for a while for the following;

If powerapps start up i see which user has logged in and get his record out a sharepointlist i created.

 

 

Collect(ColUserSettings; First(Filter('Users.Instellingen'; User().FullName in Title)))

 

 

Now i want to get a single cell out of this record and store it in a var as a string. But whatever i do i don't seems to get the data as a string in the var.

 

UserList.PNG

I'm trying to get the column Afdeling in the var but powerapps is always complaining that the var is a record and not a string (text).

 

How i'm trying it to do is like this:

 

Set(varUserAfdeling; ColUserSettings.Afdeling)

 

 

The point eventually is that i store all the setting from the user for the app in the sharepointlist. So for this example the data will be filtered automaticly on the string we find in the column "Afdeling". I also try'd to use the cell directly in the default tab of the dropdown of the filter options. Like this:

 

If(ColUserSettings.Afdeling = "Bottelarij"; ColUserSettings.Afdeling)

 

 

 But get the error that he is expecting a record and not a string.

 

I hope my question made some sense.

 

Thanks at advance!

Kind regards,

Ward

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    HI @Ward_1984 

    Powerapps recognizes tables, records and fields.  All PowerApps controls are set to accept as one of these types.  For example, a Textinput or label control can only accept a field.  Most of the other controls can accept tables and a form control can only accept a record.  In PowerApps a variable can be a table, record or field.  Since I don't understand your language, take for example, a dropdown control.  It uses a table as its Items property but selects a single record and displays a field value in the window.  However. all fields in the record selected are accessible and can be viewed in labels using the following syntax

    Dropdown1.Selected.Field1value, Dropdown1.Selected.Field2value  where Field1value and Field2value are the names of the fields in the selected record.

    To obtain a record to use in a form, you would use Dropdown1.Selected, Gallery1.Selected, or Datatable1.Selected  since that defines a single record.

    The Filter function takes a table and reduces it to a smaller table.  The Lookup function can take a table and reduce it to either a single record or a single field within that record.  Consider

    Lookup(table,ID=Dropdown1.Selected.ID) will produce a record suitable for a form.

    Lookup(table,ID=Dropdown1.Selected.ID, fieldvalue) produces a single field from a table suitable for the Default property of a textbox or the Text property of a label. 

    I hope that this helps you understand how to retrieve the data you seek.

     

     

  • Verified answer
    Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

    @Ward_1984 ,

    The "ColUserSettings.Afdeling" returns a column of data from a table. Although you only have one row it is still a table. You can easily fix this by using First().

     

    Example:

    Set(varUserAfdeling; First(ColUserSettings).Afdeling)

     

  • Ward_1984 Profile Picture
    52 on at

    @Jeff_Thorpe  @Drrickryp ,

    Thanks for the reply!

     

    I don't put the data in a collection anymore like you suggested (@Jeff_Thorpe); but directly in a var with the lookup like @Drrickryp said (it's cleaner so thanks for that 😉

    Set(varUser; LookUp('Users.Instellingen';User().FullName in Title))

     

    And now i can indeed use varUser.Afdeling and all the other colums like i wanted in the beginning. So if i understand correctly my problem was that i used a collection and a collection is always a type of table and never a record? 

     

    Thanks again.

    Ward

  • gjgiraldo Profile Picture
    14 on at

    you can try

    ForAll(
    Data,
    {
    Title: Text(Value.Title),
    ID: Text(Value.ID),
    Activities: ForAll(Table(Value.Activities),Value.Value)

    }
    )

  • AntoniosK Profile Picture
    16 on at

    Please note that there is a typo: You should use a comma ' , ' instead of a semicolon ' ; ' after the declaration of the variable.

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard