Survey design and xPath: automatically detect tablet/PC?

  • Asked
  • Active
  • Viewed 4683 times
0

Hi Team,

I plan to add guidance for slope correction values of plot radii (i.e. a function showing message as a text field) based on given slope angle, but that will be needed only in Mobile but not in Collect on desktop/laptop. Is there any way to detect the platform by using xPath language?

Regards, Lauri

0

Accepted answer

Hi Lauri,
Having a custom XPath function to determine if you are running on Collect on the mobile device is already in our plans.
When this function will be available, how do you want to display the text field message to the user?
Thanks,
Open Foris Team

0

Accepted answer

It can be shown on Mobile as a text field using a function, but not included in data export.

-Lauri

0

Accepted answer

In the newest Collect v 3.22.1 there are now new custom Environment functions:

  • env:desktop() : returns true if Collect runs on a desktop computer, false otherwise (e.g. in Android)

  • env:mobile() : opposite of env:desktop()

and Mathematical functions:

  • asin/acos/atan : arc sine, arc cosine and arc tangent of a specified angle

An example: showing slope correction for 15m plot radius when slope more than 5 degrees (or less than -5):

  • add numeric field "slope" (unit: degrees)
  • add text field for a text message on Mobile
  • select "Calculated"
  • unselect "Include in data export"
  • add Relevant expression:

    env:mobile() and math:abs(slope)>5

  • add Calculated expression

format-number(15 div math:sqrt(math:cos(math:abs(slope))),"0.00")

and Apply when rule:

env:mobile() and math:abs(slope)>5

This may need some further development, but the basic idea is here.

regards, Lauri

Your answer

Markdown text. Shortcuts: Ctrl+B bold, Ctrl+I italic, Ctrl+K link, Ctrl+E code, Ctrl+Shift+V paste as plain text. Tab indents list items and code; press Escape, then Tab, to leave the text box.

Insert an image

Say what the image shows, for people who can't see it.

Keyboard shortcuts

Anywhere

?
Show this list
/
Search
g h
Go to the home page
g q
Go to the questions
g t
Go to the tags
g u
Go to the users
a
Ask a question

Lists of questions

j k
Next or previous question
Enter
Open the question

Question pages

j k
Next or previous post

Shortcuts never apply while you type in a text field. Members can turn them off in their preferences.