Conditional Action Button

Hi, 

I need to hide the add action button if theres a register added today with the actual logged user (Usersettings)

For example, if the user1 is logged and theres a register in the table Class, then hide the action button.

 

Solved Solved
1 6 227
1 ACCEPTED SOLUTION

@Suvrutt_Gurjar sorry to jump in , am just learning and would like to suggest an approach and I'd like your feedback: 

@Yeyo1976 i would create a slice of the Class table to show today's records using this expression 

AND(
[Email] = USERSETTINGS("Email"),
[Date] = TODAY()
)

This will display the records of today only 

Then for a the action , show_If id use an expression :

NOT(

IN(USERSETTINGS("Email"),Todays_Record[Email])

)

I'd leave the judgment to our pro @Suvrutt_Gurjar 

View solution in original post

6 REPLIES 6

Is it correct understanding that basically you would like to allow any user to create one record per day in the Class table?

Also is there an email column that registers user's email and a date column that records the date when a record is created in the Class table?

Hi, yes, basically it's that what I need.

Please try below.

Create a slice called say "Todays_Register" on the Class table with a row filter expression something like 

AND([Date]=TODAY() , [Email]=USEREMAIL()) 

In the Add action's behavior setting please add an expression something like 

COUNT(Todays_Register[Key Column of Class Table])=0 

This expression should make the Add action to disappear when a record is added by the user on a day.

Also in the [Date] column's valid_if setting please add an expression something like

ISBLANK(
FILTER(
"Class Table",
AND([_THIS] = [Date], USEREMAIL()=[Email])
)
- LIST([_THISROW])
)

 

Please test well for all edge cases.

@Suvrutt_Gurjar sorry to jump in , am just learning and would like to suggest an approach and I'd like your feedback: 

@Yeyo1976 i would create a slice of the Class table to show today's records using this expression 

AND(
[Email] = USERSETTINGS("Email"),
[Date] = TODAY()
)

This will display the records of today only 

Then for a the action , show_If id use an expression :

NOT(

IN(USERSETTINGS("Email"),Todays_Record[Email])

)

I'd leave the judgment to our pro @Suvrutt_Gurjar 


@Hussein_Osseily wrote:

AND(
[Email] = USERSETTINGS("Email"),
[Date] = TODAY()
)


 

Hi @Hussein_Osseily , 

If I may add, the above expression is similar to the one I mentioned for the slice filter.

However, I believe hiding the add action for only today's records may not help as the user could possibly add /update previous day's records. That is why additionally suggested a valid_if expression in the [Date] column to avoid duplicates of date column.

Hope this helps.

Thanks @Suvrutt_Gurjar for always sharing your knowledge.  

The valid_If was a great approach to prevent adding/editing previous records that honestly i didn't think of. 

Top Labels in this Space