Bug: CONTEXT("Host") is always retuning "Server" although I am running from a browser/editor

CONTEXT(“Host”) is always retuning “Server” although I am running from a browser/editor.

That’s messing up my apps using the expression :frowning:

Is the expression being evaluated during a workflow? Where is the formula being used?

1 Like

If you use the “Test” button from inside expression editor, I believe it will always return “Server”, but it should be returning the correct value when actually in use.

2 Likes

I added in virtual coumn

Could you show a screenshot of where you’re using the formula?

What is your end goal? Are you trying to hide a view based on CONTEXT()? Restrict table permissions?

So I want to make a column required only when it’s opened via device or browser. If a row is inserted via API call, make the column not required.

So I have a column named “From Server” with the expression CONTEXT(“Host”)=“Server” . I make it virtual because there are multiple columns to use the condition.

So the columns with required condition NOT([From Server]) are not set as required because the virtual column is always returning true.

You can test it by add CONTEXT(“Host”) and check its value in browser, device. All cases will return “Server”

Following is screenshot from my test app.

Oh, this is interesting.

Notice that this is a Form view:


Then I save it, and am viewing the Detail view, notice there is still a pending sync.

But after the Sync is finished:

This is because a virtual column is calculated upon every sync. At first, in the Form, the Host Context is indeed Browser. But then when that VC is recalculated upon the next sync, it has been recalculated by the Server, so that value switches to TRUE. So you’re going to have to come up with a slightly different way to accomplish your goal here.

I would suggest getting rid of the [From Server] virtual column, and instead just put

CONTEXT(“Host”) <> “Server”

In the Required_If fields for the other columns.

4 Likes

You really like the word, “so”. :smiley:

image

1 Like

Yep!

haha… just realized it.

1 Like

Sounds like a plan :slight_smile: Thanks

1 Like