New Bug Encountered: IFS statement returns wrong value

Nate_T
New Member

I have an IFS statement:

IFS(LOOKUP(USEREMAIL(), Users, Usr_Email, Time_View) = “This Pay Period”,
“THIS”,
LOOKUP(USEREMAIL(), Users, Usr_Email, Time_View) = “Last Pay Period”,
“LAST”
)

It checks the selection from an Enum value, “Time_View” but it always returns the opposite value.
“This Pay Period” returns “LAST”
and “Last Pay Period” returns “THIS”…

I have tried using a switch case instead and still had the same issue…

0 10 444
10 REPLIES 10

Hi @Nate_T Did you test this in the expression tester?

I recommend testing the expression in pieces. Start with just the inner part that I quoted, and make sure it is working correctly, then add on to it.

Steve
Platinum 4
Platinum 4

I agree with both @Lynn and @Marc_Dillon: test the LOOKUP() expression in Expression Assistant. Your IFS() expression looks correct, but you could have problems if USEREMAIL() returns blank (e.g., if your app is open to the public) or if the LOOKUP() returns blank (e.g., if the user’s email isn’t in Users).

This expression might help troubleshoot:

IF(
  ISBLANK(USEREMAIL()),
  "no useremail",
  SWITCH(
    LOOKUP(
      USEREMAIL(),
      "Users",
      "Usr_Email",
      "Time_View"
    ),
    "This Pay Period", "THIS",
    "Last Pay Period", "LAST",
    "no time_view"
  )
)

Nate_T
New Member

Thanks for the suggestions everyone!
Steve, I tried your expression and it yields the exact same results.

Even the following expression results in the same issue:
CONCATENATE(USEREMAIL(), " ", LOOKUP(USEREMAIL(), Users, Usr_Email, Time_View))
The result consistently returns my email with the opposite string after it.

I also tried adding a virtual column with the exact same expression. It’s result ends up being correct after a sync happens (Delayed sync is enabled). But if I quickly select back and forth between them before it has a chance to sync, both of the returned values update immediately and both are wrong.
Then, after the sync completes, the virtual column finally goes back to what it should be…

*Forgot to mention - I am using a google spreadsheet to hold my data. The selection in Appsheet is properly reflected in the google spreadsheet.

Are either of the Usr_Email or Time_View columns of the Users table virtual columns? If so, what are the app formulas?

Do any of the corresponding worksheet cells have formulas?

Is Users a slice? If so what is the row filter expression?

Does the Users table have a security filter? If so, what is it?

Nate_T
New Member

Usr_Email is a static cell and is used as the key column in the Users table and does not have any formula.
Time_View is an Enum type with two selections, “This pay period” and “Last Pay Period” with no formula.
Both Usr_Email and Time_View are columns in the Users table in the Google sheet.

Date_Display set as type “text” which holds the formulas that we have been discussing. Date_Display is also in the Google spreadsheet.

There are no formulas in the google sheet. All formulas are in Appsheet.

Users is not a slice and has no security filter. This app is for one company with less than 10 users that are added to the whitelist.

I’m at a loss, then. I suggest you reach out directly to support@appsheet.com for deeper help than I can provide.

Ok thanks Steve!

Nate_T
New Member

I solved the issue by deleting the table from Appsheet and re-adding it.

I didn’t get a final response from Appsheet support but the cause of the issue seemed to be related to regenerating the table…

I must admit, I have also experienced problems that were solved that way…

Top Labels in this Space