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

asked 19 Oct '17, 02:34

LauriV's gravatar image

LauriV
1912210
accept rate: 12%


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

permanent link

answered 19 Oct '17, 17:31

OF%20Collect's gravatar image

OF Collect ♦♦
2.0k5
accept rate: 19%

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

-Lauri

permanent link

answered 20 Oct '17, 00:38

LauriV's gravatar image

LauriV
1912210
accept rate: 12%

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

permanent link

answered 08 Jun, 12:04

LauriV's gravatar image

LauriV
1912210
accept rate: 12%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×272

question asked: 19 Oct '17, 02:34

question was seen: 503 times

last updated: 08 Jun, 12:04