Public app CONTEXT(“Device”)

Hello there,
In public app to prevent multiple filling the form

  1. What is the best way to use CONTEXT(“Device”) ?
  2. Can I also add UNIQUEID() ?

( CONTEXT("Host") = "Browser" )
( CONTEXT("Host") = "Device" )

or

ifs(
context(“Host”)=“Device”,“Please use browser instead !”,
context(“Host”)=“Browser”,“Please use device instead !”
)

or

ifs(
context(“Host”)=“Device”,“Tap Below To:”,
context(“Host”)=“Browser”,“Click Below To:”)

Should I use it to Show if ? ? It would be great if button in the menu will be hidden after filled form.

Or to INITIAL VALUE in the form/where exactly ?

Please elaborate on this. Perhaps you only want one record added per user per day? Or only one record per user, ever?

You’d have to record CONTEXT(“Device”) as one of the columns in the table being added to. Note that CONTEXT(“Device”) is not a 100% reliable indicator of identifying a user, as discussed here:

What do you mean by this, add it where?

You would utilize CONTEXT(“Device”) in that view’s show_If to hide the view once used. You’ll need to take care of the above suggestion and question first though.

2 Likes

Thanks for a reply, for first I am sorry for my bad knowledge about codes :smiley:

I want only one record (map ping) per user EVER

Yes, thank you I visited all of these posts I think before, thats because I am asking if anybody knows what is the best choice, so the 3 examples what I wrote (and found in legacy you posted) are correct to use in data table column to initial value ? Also what type of column is the best for it ? or it doesnt matter

Can I also add UNIQUEID() ?
What do you mean by this, add it where? > Just if this has some utilization for me with this type of of public app to better identify

So there are 2 possibilities where to write CONTEXT(“Device”) ? to initial value and to show if ?
Should I write it to both ? (initial and show if ?) or ?

Why I need to take care of the above suggestion and question first though ?

The best way would be the hidden view after you once filled form My vision

You’ll need a column in the table in question for the device ID. Let’s called it [Device]. You can use either Initial Value or App Formula in this case, and set it to:

CONTEXT(“Device”)

CONTEXT() returns a text value, so this column should be a Text type column.

Then for the Show_If expression for the Form View, you need to check for the existence of a record in the table where the device ID matches the current user’s device ID. e.g.

ISBLANK( FILTER( table , [Device] = CONTEXT(“Device”) ) )


There is nothing about a Public app that would stop you from using UNIQUEID() anywhere. I’m not sure how this at all relates to this problem though.

3 Likes

Thanks
Great it works, but after I refresh the app, the view is gonna to appear back and I can fill the FORM again from same device. What I did wrong ?

It doesnt matter if this from browser or the mobile ?

So I tried add CONTEXT(“Device”) to formula and to initial value and its same, so it doesnt matter here ?

Pic for better orientation and understanding (also I need to fix serial numbers, but later :smiley: ) (view Join in is from table Usersdata

I would suspect it is because your [Serial] column is set as the Key column, but it does not have unique values.

What doesn’t matter?
The same person using a different device (or even a different browser) will have a different Device ID and will be able to see this form more than once.

In this case, no it doesn’t really matter. See this article for more info.

3 Likes