cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AmateurDev
Regular Visitor

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
Anonymous
Not applicable

Hi @AmateurDev 

 

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

 

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

 

Thanks.

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @AmateurDev 

 

to pass values to another screen

 

Navigate(Screen_ReportDetails,ScreenTransition.CoverRight, {Title: ThisItem} )
v-yutliu-msft
Community Support
Community Support

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.

@v-yutliu-msft @Anonymous 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.

 

OnSelect function in the galleryOnSelect function in the gallery

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

Icon which the user clicks to navigate to the report info screenIcon 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.

Data card on the Report Details screenData 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".

Error message on the Report Details screen when I reference the galleryError 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 on the data card which shows the report detailsLabel on the data card which shows the report details

 

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

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

Anonymous
Not applicable

Hi @AmateurDev 

 

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

 

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

 

Thanks.

@AnonymousThat did the trick - thank you!

 

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

Anonymous
Not applicable

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (4,020)