Can't figure out the formula

I watched some video review in youtube about app for employee presence. Then tried to adapt that app for my office but still confused about the app mechanism. The app maybe simple but I still can’t figure it out. Here the screenshot for better explanation

In the first image. This show the table view of Presence In for employee

Then the second image. This show the table view of Presence Out and integrated with the Presence In data. Certainly this view is using slice. In this view of Presence Out, employee click the data table to entry the out of office time

The third image. This is the Presence Out Form that I confused to make. In the form employee can see the previous time for presence in. And then automatically the time for presence out set. I try to use for both presence time in and out the TIMENOW() or NOW() to set automatically for the time. But when I click this Presence Out Form, the time for presence in changed with present time. So the time for presence in and out are same time now.

So how can this app can lock the previous time for presence in so that I can calculate the duration of work hour. Please share and give me your suggestion. Thank you

Move your expression of NOW() or TIMENOW() to Initial Value.

1 Like

Jam Masuk

Required?

(CONTEXT("View") = "In")

Initial value

TIMENOW()

Editable?

FALSE

Reset on edit?

AND(
  (CONTEXT("View") = "In"),
  ISBLANK([Jam Masuk]),
  ISBLANK([Jam Keluar])
)

Jam Keluar

Valid If

([_THIS] >= [Jam Masuk])

Required?

(CONTEXT("View") = "Out")

Initial value

IFS(
  AND(
    (CONTEXT("View") = "Out"),
    ISNOTBLANK([Jam Masuk])
  ),
    TIMENOW()
)

Editable?

FALSE

Reset on edit?

AND(
  (CONTEXT("View") = "Out"),
  ISNOTBLANK([Jam Masuk]),
  ISBLANK([Jam Keluar])
)
2 Likes

Just like my explanation that didn’t work. Because when formula put in initial value and not editable the column didn’t show in the form. And I want the time to automatically set and can’t be edit in the form. Thanks

Try to follow through the guidance from Steve above and let us know.

1 Like

Thanks Steve, is it alright if Im using Slices in the app? Because the “IFS” and “AND” formula above got error warning. “could not be parsed due to exception: Sequence contains no elements.”

Try to remove this:

2 Likes

Thanks Heru, the formula is correct now. But then another warning : Control ‘In’ could not find data ‘In’ and Control ‘Out’ could not find data ‘Out’

1 Like

Could you try to write it like:

AND(
	("Out"= CONTEXT("View")),
	ISNOTBLANK([Jam Masuk]),
	ISBLANK([Jam keluar])
)

and similarly to the IFS also.

If still not working, please share screen shoot of the actual expression and also the error.

2 Likes

Fixed in the original. Thanks!

1 Like

Replace In and Out with the names of the corresponding views in your app configuration.

Yep its worked. But next problem, in the form “Jam Pulang” not showing. Wkwkwk

Yep its worked. But next problem, in the form “Jam Pulang” not showing (time for presence out dissappear)

1 Like

I am a bit lost without snapshot, Perhaps you need to change something to the Required? for the Jam Keluar.
If you save the form, did the number go through?

1 Like

This is the first you’ve mentioned Jam Pulang.

1 Like

Thank you for Steve Coile and Heru Herlambang for guidance. After many configuration, it works.

For Jam Masuk , just like formula mentioned by Steve Coile.

And for Jam Keluar, the formula became like this:

Valif If

([_THIS] > [Jam Masuk])

Required?

ON

App Formula

IFS(ISNOTBLANK([Jam Masuk]), TIMENOW())

Editable?
ON

Reset on Edit?

([_THIS] = [Jam Masuk])

2 Likes