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

How to filter certain users that start at certain times?

Good morning

 

I'm trying to create a timekeeper app and when the user clicks 'login' I need there to be a check on the user to see if they have ANA next to their record in dataverse. If they have 'ANA' next to their record in dataverse then they need to have a default start time of 7am for them. Right now I have - 

Collect(
    'Time',
    {
        'User Code': TextInputUserCode.Text,
        'Login Time': DateTimeValue("7:00 AM"),
        'Logged In': Text("Yes"),
    }
);

This logic works for all users and starts them at 7am. How can I filter it so that it only works for users with ANA next to their record in dataverse and the rest of the users have login time 'Now()'. 

I;m guessing I have to create some sort of 'if' statement but Im unsure how to write it. 

 

I've also created another post in the dataverse forum to have a 7:00am default column next to each user so that I can just filter it this way but I dont think dataverse allows date and custom time columns, only date and time right now columns. 

 

Any help is much appreciated. Thank you all. 

1 ACCEPTED SOLUTION

Accepted Solutions

@Usernametwice23 

 

 

Based on LookUp function: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup#syntax

 

LookUp(Table*, Formula [, ReductionFormula ] )

  • Table - Required. Table to search. In the UI, the syntax is shown as source above the function box.
  • Formula - Required. The formula by which each record of the table is evaluated. The function returns the first record that results in true. You can reference columns within the table. In the UI, the syntax is shown as condition above the function box.
  • ReductionFormula - Optional. This formula is evaluated over the record that was found, and then reduces the record to a single value. You can reference columns within the table. If you don't use this parameter, the function returns the full record from the table. In the UI, the syntax is shown as result above the function box.

 

Once the specific user tries to Log in, can try LookUp function to find the unique User in the Dataverse table. For example, you can do something like

Lookup('Users','emailaddress1' = User().Email)

 

Presuming a Dataverse table called Users and a column called 'emailaddress1' that has a Unique value in there. You can replace with values that make more sense for your use case.

 

Once you have fetched the unique user, you can easily just access that specific user's information thereafter. 

You can even cross reference with the 'Time' dataverse table (if needed and if that's a table you have) and fetch/populate only that specific user's record with that information you want, perhaps by using the LookUp function again on the 'Time' table for example to check for and write to the specific Time record for that specific User only, perhaps by a unique identifying key like the e-mail address (for example) to LookUp by.  

 

Check if something like the above helps.

View solution in original post

3 REPLIES 3
poweractivate
Super User
Super User

@Usernametwice23 

 


@Usernametwice23 wrote:

 'ANA' next to their record in dataverse




 

About  'ANA' next to their record in dataverse - what do you mean by that? Is this 'Ana' a value of a specific column in dataverse? Assuming it is you can use the Filter function to narrow down by that value ANA in that column. However, am not sure what you mean can you clarify it? For example - is it something else like a part of a value of an existing column that may have something else on it instead - or even something else entirely?

 

 

Usernametwice23
Helper V
Helper V

Hi @poweractivate 

 

Sorry I should have clarified. It is a lookup column in the users table in dataverse. 

@Usernametwice23 

 

 

Based on LookUp function: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup#syntax

 

LookUp(Table*, Formula [, ReductionFormula ] )

  • Table - Required. Table to search. In the UI, the syntax is shown as source above the function box.
  • Formula - Required. The formula by which each record of the table is evaluated. The function returns the first record that results in true. You can reference columns within the table. In the UI, the syntax is shown as condition above the function box.
  • ReductionFormula - Optional. This formula is evaluated over the record that was found, and then reduces the record to a single value. You can reference columns within the table. If you don't use this parameter, the function returns the full record from the table. In the UI, the syntax is shown as result above the function box.

 

Once the specific user tries to Log in, can try LookUp function to find the unique User in the Dataverse table. For example, you can do something like

Lookup('Users','emailaddress1' = User().Email)

 

Presuming a Dataverse table called Users and a column called 'emailaddress1' that has a Unique value in there. You can replace with values that make more sense for your use case.

 

Once you have fetched the unique user, you can easily just access that specific user's information thereafter. 

You can even cross reference with the 'Time' dataverse table (if needed and if that's a table you have) and fetch/populate only that specific user's record with that information you want, perhaps by using the LookUp function again on the 'Time' table for example to check for and write to the specific Time record for that specific User only, perhaps by a unique identifying key like the e-mail address (for example) to LookUp by.  

 

Check if something like the above helps.

Helpful resources

Announcements
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.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,598)