cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
hev-fj
Frequent Visitor

Gallery: Check if the field exists in the data source using ThisItem.

Is it possible to check if a field is exist in the data source of the gallery using ThisItem?

Scenario example:

 

Let's say I have two data sources, DATA_A and DATA_B.

DATA_A has field Name, Lastname.

And DATA_B has field Name, Lastname, Age.

 

The gallery I have can display either one of the two data sources depending on which data source the user selects using a button.

 

Inside the gallery, I have three labels to show the information of the data source (such as the Name, Lastname, and Age).

So the labels have formula that looks something like this: ThisItem.Name , ThisItem.Lastname, ThisItem.Age.

 

My problem is, when the user selects data source DATA_A, the ThisItem.Age will give me an error because that field doesn't exist in DATA_A. 

Is there a way to check if a field exists?

I want something like this for my label:

If(fieldIsExist, ThisItem.Age, "-")

 

Thank you!

 

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User
Super User

I suggest you rather add a Blank Column for the Datasource without the Age as:

AddColumns(Data_B,"Age","")

 

So replace the formula with the Data_B used in your Button. 

That would remove the error as ThisItem.Age would be blank.

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

 

 

View solution in original post

1 REPLY 1
eka24
Super User
Super User

I suggest you rather add a Blank Column for the Datasource without the Age as:

AddColumns(Data_B,"Age","")

 

So replace the formula with the Data_B used in your Button. 

That would remove the error as ThisItem.Age would be blank.

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

 

 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,769)