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

Solved Solved
0 11 409
1 ACCEPTED SOLUTION

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.

View solution in original post

11 REPLIES 11

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

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”

You really like the word, “so”.

3X_5_b_5be2e30b277b617e43c4abe7ab7ed1e9b791e6de.png

haha… just realized it.

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.

Yep!

Sounds like a plan Thanks

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.

Top Labels in this Space