cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User
Super User

IsBlank First record

I need to set the DisplayMode property of a control based on if the first record in a collection is blank.

 

I can't use IsEmpty(CollectionName) because it's used in a gallery and always has a 'show saved' value in the first record, regardless if there is other data in that record.  It's a pseudo InfoPath repeating table.

 

I don't get any syntax errors with this but it also doesn't change the DisplayMode Property.

 

If(IsBlank(First(Markets.Region)), Disabled)

 

Any suggestions for using the 'First' function along with If and IsBlank to help set visibility or displaymode?



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
1 ACCEPTED SOLUTION

Accepted Solutions
Resident Rockstar
Resident Rockstar

First(Markets.Region)

 

This part should be

First(Markets).Region

 

Because you want the first record of the Marjets list and a check on the Region Property, right. Rest of the if() formula you can get from the other answers.

 

But be aware that with this solution ordering the gallery will break your logic.

 

Hope this helps.

 

 

View solution in original post

6 REPLIES 6
Super User II
Super User II

Hi @JR-BejeweledOne 

If(First(Filter(Markets,IsBlank(Region), DisplayMode.Disabled,DisplayMode.Edit)

in the DisplayMode property of the control, assuming Markets is the name of the collection. 

 

 

 

It doesn't like that.   Since First is being specified, indicating the first record in the collection, is filter really needed?



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

Hi @JR-BejeweledOne 

If the collection is prefiltered and presorted, probably you are correct.  Could you provide a bit more information regarding the context in which you are using this information?

Helper V
Helper V

You could try using a Lookup to return the blank record then test if a column within that record is blank.

 

If(
    IsBlank(LookUp(Markets,IsBlank(Region),Region)), 
    DisplayMode.Disabled,
    DisplayMode.Edit
)

 

Resident Rockstar
Resident Rockstar

First(Markets.Region)

 

This part should be

First(Markets).Region

 

Because you want the first record of the Marjets list and a check on the Region Property, right. Rest of the if() formula you can get from the other answers.

 

But be aware that with this solution ordering the gallery will break your logic.

 

Hope this helps.

 

 

View solution in original post

Community Support
Community Support

Hi@JR-BejeweledOne,

 

Based on the issue you mentioned, you want to disable the button if the first record in your collection is blank.

Do you mean check if there is a field empty for the first record in your collection? You need to refer the first record to get the field value which is the goal to check if is blank.

On this premise, please modify your formula as below:

If(IsBlank(First(Markets).Region),DisplayMode.Disabled,DisplayMode.Edit)

 

Best Regards,

Qi Qiao

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (50,871)