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 416
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