cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kadd
Resolver III
Resolver III

Reference to a People field when exporting to CSV

Hello,

 

Hope you're all doing good.

 

The quetion today is...

 

I created a form that i want to export to a CSV file. I manage to do it, it works BUT....one of my fields in my data source is a People picker field.

 

So basically what i'm doing is collecting the filtered data from my data source into a collection.

Assigning the content of my collection to a variable that will become the content of my CSV file.

 

the formula used for this is  

Set(varExportExpert,"Department, Expert"Char(10)&Concat(CollExpert, Department &","& Expert &Char(10))); 

 

"Expert" (which is the value of my expert) under the Concat function is missing something to reference my user the right way.

 

The error i get is "Invalid argument type. Expecting one of the following : Text, Number, Boolean, OptionSetValue, ViewValue"

 

So i replaced it by  Expert.DisplayName and Expert.Value but the error is still there.

 

Would anyone have an idea how this could be solved ?

 

Thanks a lot for your time !

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi @WarrenBelz 

 

I understand. but if you're not using complex fields anymore, how do you load the people or lookups and choose them in a text field ? (if i can ask... 😛 )

 

Now in this specific case, i reference the SharePoint list (not the galleries) cause it's a big, complex form with different screens and galleries are not yet loaded when users do the export. (they only do if they go through the screens first) .

 

Ok so best option is to add my other field holding a text value of the People picker...

 

ok...thanks !! 🙂

View solution in original post

Hi @Kadd ,

For the first, the Office365Users.Connector will get you all the information you need in a Combo box and the second, you simply do the lookup (actually a filter) in Power Apps using the same list as you would have looked up.

 

To answer your question, the first case applies - replace the text box with a combo box - example this gives you up to 999 names with a search function

Office365Users.SearchUser(
    {
        top: 999,
        searchTerm: Self.SearchText
    }
)

then set DisplayName as both the Primary text and Searchfield. The Update of the card will then be

ComboboxName.Selected.DisplayName

and all the other people fields for the record (Department etc) can be available

ComboboxName.Selected.Department

 

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.

 

View solution in original post

6 REPLIES 6
WarrenBelz
Super User
Super User

Hi @Kadd ,

I am not sure what you are doing at the start (seems to be some code missing), however try this for your Concat

Concat(
   AddColumns(
      CollExpert,
      "aExpert",
      Expert.DisplayName
   ),
   Department & "," & aExpert & Char(10)
); 

 

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.

Hi @WarrenBelz ,

 

Thanks a lot for your answer.

 

unfortunately, it doesn't solve it 😞 the issue is still the same.

At the "AddColumns" level there is no error but there is one in the body of the concat (aExpert is underlined in red)

 

First part of the code is just the creation of the collection CollExpert based on my SharePoint list.

 

 

 

ClearCollect(CollExpert,ShowColumns(Filter(Experts,DPAID=Value(DPAIDKey.Text)),"Department","Expert"));

 

 

 

 

This creates and populates the collection with the right data.

 

Thinking about it last night, i thought i could do it adding a text column to my list where i would store the expert name as a text... but i admit if i can do without ... 😛

 

Thanks 

@Kadd ,

You were missing a bit of code on the start in your original post.

I do not (and have not for a long time) used complex field types such as people and lookup columns. They are not necessary in Power Apps as you can get the data you require with queries/connectors and simply write what you want to store back to Text fields. Most of the sorting/filtering/delegation issue then simply go away.

 

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.

Hi @WarrenBelz 

 

I understand. but if you're not using complex fields anymore, how do you load the people or lookups and choose them in a text field ? (if i can ask... 😛 )

 

Now in this specific case, i reference the SharePoint list (not the galleries) cause it's a big, complex form with different screens and galleries are not yet loaded when users do the export. (they only do if they go through the screens first) .

 

Ok so best option is to add my other field holding a text value of the People picker...

 

ok...thanks !! 🙂

Hi @Kadd ,

For the first, the Office365Users.Connector will get you all the information you need in a Combo box and the second, you simply do the lookup (actually a filter) in Power Apps using the same list as you would have looked up.

 

To answer your question, the first case applies - replace the text box with a combo box - example this gives you up to 999 names with a search function

Office365Users.SearchUser(
    {
        top: 999,
        searchTerm: Self.SearchText
    }
)

then set DisplayName as both the Primary text and Searchfield. The Update of the card will then be

ComboboxName.Selected.DisplayName

and all the other people fields for the record (Department etc) can be available

ComboboxName.Selected.Department

 

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.

 

Hi @WarrenBelz 

 

Thanks for your answer.

ok, this i do ..but in this specific case i have to reference the data source cause i have multiple tabs (different screens related to different data sources).

 

ok good so i'm too bad... 😄

 

Thanks again and have a great week end !

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,148)