cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
AmateurDev
Level: Powered On

Invalid argument type (Text), Expecting a Record value instead

I am building a report catalog application and have repeatedly run into the error message "Invalid argument type (Text), Expecting a Record value instead" in a few different places.

 

One scenario is when navigating to a new screen from my gallery.  I have a gallery of available reports filled from a SharePoint list.  In the gallery, I have an information icon which opens a new screen to show some information about the report (e.g. title, description).  But when I click the information icon, the information screen always shows the first item in my SharePoint list, not the report I've clicked on.  The OnSelect code for the information icon is:

 

Navigate(Screen_ReportDetails,ScreenTransition.CoverRight)

When I add some context to the OnSelect code, I get the "Invalid argument type" error message.

 

Navigate(Screen_ReportDetails,ScreenTransition.CoverRight,Title: ThisItem)

Similarly, I have a star icon which I'd like to use to enable users to save favorite reports.  I have another SharePoint list with a field for the report name and the user's email.  Someone here helped me with this OnSelect code for the favorite icon.  However, this code also gives the "Invalid argument type" error.

If(Icon_Favorite.Fill=Blue,  // or whatever fill color you picked above
   RemoveIf('User Report Favorites', Title=ThisItem.Title && UserFavorite=User().Email),
   Patch('User Report Favorites',
         Defaults('User Report Favorites'),
         {
             Title: ThisItem.Title,
             UserFavorite: User().Email
         }
   )
)   

Is there something I'm missing on my SharePoint list?  Do I have the wrong code?

 

As part of troubleshooting, I've enabled records management on my SharePoint site.  But there doesn't seem to be a way for me to change a list entry into a record.

1 ACCEPTED SOLUTION

Accepted Solutions
shailendra74
Level 10

Re: Invalid argument type (Text), Expecting a Record value instead

Hi @AmateurDev 

 

for the error - The error message is: "Expected Text Value".

 

You need to provide Gallery.Selected.<Field>. eg. gallery.Selected.ID

 

Thanks.

6 REPLIES 6
shailendra74
Level 10

Re: Invalid argument type (Text), Expecting a Record value instead

Hi @AmateurDev 

 

to pass values to another screen

 

Navigate(Screen_ReportDetails,ScreenTransition.CoverRight, {Title: ThisItem} )
Community Support Team
Community Support Team

Re: Invalid argument type (Text), Expecting a Record value instead

Hi @AmateurDev ,

1)Do you mean that the display form always show the first item?
Could you show me your settings about the display form, especially the Item property?

I suggest you set the display form's Item:

Gallery1.Selected

Here's a doc about gallery,displayform, edit form for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-forms

2)If you want to pass variable, the right syntax is :

Navigate( Screen , Transition ,{vairablename:....})

On your side, try this formula:

Navigate(Screen_ReportDetails,ScreenTransition.CoverRight,{Title: ThisItem})

Here's a doc about Navigate function for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-navigate

3)Could you tell me the data type of UserFavorite field?

 

 

Best regards,

Community Support Team _ Phoebe Liu

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
AmateurDev
Level: Powered On

Re: Invalid argument type (Text), Expecting a Record value instead

@v-yutliu-msft @shailendra74 Thank you both for the responses.  I've updated the OnSelect property of my gallery to the following and there's no error.  However, it still doesn't pass along the context/variable to the next screen.

Navigate(Screen_ReportDetails, ScreenTransition.None, {Title: ThisItem}

 

Here is the code in my Report List gallery.  On the gallery, I have two icons: one opens the Report Details screen and the other opens the report itself in SSRS.

 

Gallery_Report_List OnSelect.pngOnSelect function in the gallery

Here is the code for my information icon which opens the Report Details screen.

Icon_MoreInfo.pngIcon which the user clicks to navigate to the report info screen

This is the data card showing the report title on the Report Details screen.  There are other data cards on this screen, which also always show information about the first report in the SharePoint list, but I think if I solve this card, I can apply the solution to the rest of the cards.

Card_ReportTitle.pngData card on the Report Details screen

Here's the recommended code showing an error.  I get the same error when I enter this code in the DataField property or the Default property.  The error message is: "Expected Text Value".

Card_ReportTitle-Error.pngError message on the Report Details screen when I reference the gallery

Here's the parameters for the label on the above data card which shows the report title.  Posting this for reference in case there need to be any changes.

Label_DataCardValue.pngLabel on the data card which shows the report details

 

Regarding the user favorites, it is an icon.  The code is below:

Icon_Favorite.pngIcon which user selects to add/remove items in the SharePoint list indicating it's a favorite report.

shailendra74
Level 10

Re: Invalid argument type (Text), Expecting a Record value instead

Hi @AmateurDev 

 

for the error - The error message is: "Expected Text Value".

 

You need to provide Gallery.Selected.<Field>. eg. gallery.Selected.ID

 

Thanks.

AmateurDev
Level: Powered On

Re: Invalid argument type (Text), Expecting a Record value instead

@shailendra74That did the trick - thank you!

 

What about my question about the user favorites?  Any idea there?

shailendra74
Level 10

Re: Invalid argument type (Text), Expecting a Record value instead

Hi @AmateurDev 

 

When removing data from list/table always consider Primary Key field which is unique.

 

In your case its the SP List Item ID, 

 

 

 

RemoveIf( DataSource, Condition [, ... ] )


RemoveIf('SPLIST', ID = Gallery.Selected.ID)
// if the fav icon is placed in the gallery for each list item you can write as:

RemoveIf('SPLIST', ID = ThisItem.ID)

 

 

Thanks. 

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 177 members 5,287 guests
Recent signins:
Please welcome our newest community members: