cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dzi
Advocate II
Advocate II

Timekeeping app help

Hello Power Community,

Noob here.  My app has more unsuccessful versions than the Oxford dictionary has words.  Well, close anyway.  There is not much out there to help with a timekeeping app.  That didn’t stop me.  In a nutshell, I am working from OneDrive to update an excel sheet.  The data is pre-populated daily.  It will utilize a camera or a scanner to read a barcode (EMPLOYEE_ID).  Successful testing is sporadic. My long-winded goal is to use an input such as a toggle, radio buttons or a dropdown choice.  It would represent in and out.  Currently they each have their own page because of an iffy IF statement.  One thing to really help get the ball rolling is this:

I want to be able to update the selected item that is narrowed by the ID for the IN time currently

Scanner trigger

Patch(tblData,First(Filter(tblData,EMPLOYEE_ID=TextSearchBox1.Text)),{IN: Now()})

Camera trigger

Patch(tblData,First(Filter(tblData, EMPLOYEE_ID = BarcodeScanner1)),{IN: Label2});Reset(TextSearchBox1);SetFocus(TextSearchBox1)

(It doesn’t like the equal sign on this one and Label2 is the time result)

How can I word it to allow the value of toggle1 to choose the IN or OUT record to be updated this record only?

A manual scan shows the barcode in the search box and isolates the lone record.  A trigger is used to update the record.  Lastly critique and correct my verbiage for “This record”.  It works on and off and I would like something more hearty.  I have included a timer to allow thinking time before resetting which helps.

 

Much thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User III
Super User III

Try:

Patch(tblData,First(Filter(tblData, EMPLOYEE_ID = BarcodeScanner1)),

{IN:Label2.Text,

OUT:Label3.Text});

Reset(TextSearchBox1);

SetFocus(TextSearchBox1)

 

Assuming you have different labels for I and Out:

 

In Label2

If(Toggle1.Value=true,1,0)

 

Out Label3

If(Toggle1.Value=false1,0)

 

With this both columns will be Patched but one Will be 0 and other 1

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

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

9 REPLIES 9
eka24
Super User III
Super User III

Try:

Scanner trigger (convert TextSearchBox1 to Value)

 

Patch(tblData,First(Filter(tblData,EMPLOYEE_ID=Value(TextSearchBox1.Text))),{IN: Now()})

 

Camera trigger (Add . Text to label)

Patch(tblData,First(Filter(tblData, EMPLOYEE_ID = BarcodeScanner1)),{IN: Label2.Text});Reset(TextSearchBox1);SetFocus(TextSearchBox1)

 

Or

Patch(tblData,First(Filter(tblData, EMPLOYEE_ID =Value (BarcodeScanner1))),{IN: Label2.Text});Reset(TextSearchBox1);SetFocus(TextSearchBox1)

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

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.

TextBoxSearch1 has BarcodeScanner1 as a default.  Were you suggesting I change the default to the word "Value"?  This will create a conflict.

eka24
Super User III
Super User III

I assumed that employeeID is a number column so placing the value around barcodescanner1 Will let the two field match. If employeeID is not a number column, then value is not needed there.

 

From your last reply, you said TextSearchBox1 Defaults to the scanner. If so then change the formula to:

 

Patch(tblData,First(Filter(tblData, EMPLOYEE_ID =TextSearchBox1.Text)),{IN: Label2.Text});Reset(TextSearchBox1);SetFocus(TextSearchBox1)

 

Or if EmployeeID is a number column

Patch(tblData,First(Filter(tblData, EMPLOYEE_ID =Value (TextSearchBox1.Text))),{IN: Label2.Text});Reset(TextSearchBox1);SetFocus(TextSearchBox1)

 

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

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.

 

Any thought on how to incorporate a toggle to determine {IN: Label2.Text} from {OUT: Label2.Text} ?

Office365Master
Advocate V
Advocate V


@dzi wrote:

Hello Power Community,

Noob here.  My app has more unsuccessful versions than the Oxford dictionary has words.  Well, close anyway.  There is not much out there to help with a timekeeping app. 


Whilst I think others are pointing you in the right direction insofar as your question is concerned, out of interest I did post a blog on an Attendance Tracking app I've developed. Similar conceptually at least to a timekeeping app.

 

The blog itself probably won't help you all that much, however it does have some pretty cool techniques around developing the UI for an app such as timekeeping app. Maybe it may help you in some shape or form, or not 😊!

https://masteroffice365.com/power-apps-showcase-attendance-tracking-app/

eka24
Super User III
Super User III

Your question not clear to me but generally, Toggle is a Boolean, true or false.

 

So you can try If(Toggle1.Value=true,...,....)

You can make your question clearer

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

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.

How would that be incorporated into the code we have already discussed?  Something like this?

Patch(tblData,First(Filter(tblData, EMPLOYEE_ID = BarcodeScanner1)),if(toggle1=0{IN: Label2,OUT:Label2});Reset(TextSearchBox1);SetFocus(TextSearchBox1)

Maybe my patch statement in my attendance tracking app may actually help you, albeit that in my app I mark attendance for all people present for a given day in a single record for that class in a SQL table. The statement I use when editing that same day's attendance is akin to you having prepopulated the list of employees for the day, first signing in, then out.

 

For the code below, currentclassid_v would thus map to TextSearchBox1.Text. However to "fix" the timer issue you have what you should really do is use a variable you update in the OnChange property of the TextBox.

OnChange: UpdateContext( employee_id_v: TextSearchBox1.Text )

 

   Patch( '[dbo].[AcademicAttendance]';

          First( Filter( '[dbo].[AcademicAttendance]';

                 id=currentclassid_v

          ));

          { userspresent: First( LocalAcademicAttendanceWIP ).userspresent;

            modifiedbyid: loggedin_user_v.id;

            modifieddate: Now();

            lastsyntime: Now()

          }

   )

 

My "userspresent: First( LocalAcademicAttendanceWIP ).userspresent" is a column mapped to a Concat of all selected students present in a gallery using a checkbox (e.g "studentid-1, 1; studentid-2, 2; studentid-3, 1; studentid-4, 1" ).  Just saying so you don't get confused. I found doing it this way with one record for the class for the day made the app super efficient however it did add complexity to denormalize it for reporting and/or editing. Once it was working I wouldn't do it any other way because of how quick it makes marking attendance.

eka24
Super User III
Super User III

Try:

Patch(tblData,First(Filter(tblData, EMPLOYEE_ID = BarcodeScanner1)),

{IN:Label2.Text,

OUT:Label3.Text});

Reset(TextSearchBox1);

SetFocus(TextSearchBox1)

 

Assuming you have different labels for I and Out:

 

In Label2

If(Toggle1.Value=true,1,0)

 

Out Label3

If(Toggle1.Value=false1,0)

 

With this both columns will be Patched but one Will be 0 and other 1

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

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (41,686)