cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Roberto_el_Hajj
Helper V
Helper V

Thisitem.type error caused by the expected data type

Hello,

 
Hope you're doing well!
 
Problem:
I'm trying to get the type of an item. This item is created in dataverse where its type is choice, but whenever I try to use  "Thisitem.Type" the following error pops up ( invalid argument type (optionsetvalue). expecting a record value instead )
 
Screenshot:
Roberto_el_Hajj_0-1640697952390.pngRoberto_el_Hajj_1-1640698057545.png

 

What's the best practice to fix this issue?
 
Any help will be highly appreciated.
 
Thank you!
3 REPLIES 3
dpoggemann
Super User
Super User

Hi @Roberto_el_Hajj ,

 

Not sure I understand exactly but here is a situation / test and hopefully it is helpful.  I have a  Gallery that has a list of DSession table records and then one of the fields on this DSession is a Choice column that is mapped to DTrack that has multiple options in it...  

 

The following will check to see if the selected record in my Gallery is a "Dataverse" track and if so it will display "Match" in the text field.

If(SessionGallery.Selected.Track = DTrack.Dataverse, "Match", "Not Match")

dpoggemann_0-1640727318909.png

 

 

This works as expected for me to evaluate the Choice field on the record and see if it matches as defined value from the Options (i.e. in this case the Dataverse option).

 

 

Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew
v-xiaochen-msft
Community Support
Community Support

Hi @Roberto_el_Hajj ,

 

Could you tell me:

What control did you use? What is the control property that uses the formula?

What's varcheckinclicked?

What's TimeEntryType?

 

Best Regards,

Wearsky

 

Hello @dpoggemann @v-xiaochen-msft  , what I'm doing here is whenever a form is in new mode and a button called "Checkin" is clicked ( P.S.: I created a variable called 'varcheckinclicked' which is set by default on app start equal to no. Whenever the button check-in is clicked the variable value will turn into yes) I want to do the lookup on a table called "Time Entries" and get the value from a column called 'type' of type choice, Else, I want to set the DeafultSelectedItem of a combox equal to the existing type because it's not a new entry.

 

In brief, if the form is in new mode and button check-in clicked, go and do the lookup because it's a new entry, else get me the existing value of the type in order to place it in the combo box because the form isn't in a new mode or the button check-in wasn't clicked.

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,979)