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

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

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

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.

Top Solution Authors
Users online (3,441)