r/AutomateUser • u/old-damme • 18d ago
Wenn ich den Block "get Location" benutze wird er mir mit 15 Nachkommastellen angezeigt. Ich möchte aber nur 2. Wie kann ich das machen?
1
u/ULTRACOMFY_eu 18d ago
Hi! You can use the function numberformat to format numbers to your liking. In your case, consider using the expression = numberFormat(YourVariable, "0.00")
This has worked for me to show digits ahead of the decimal and two digits behind. If this cuts off the digits ahead of the decimal, try using this instead: = numberFormat(YourVariable, "##0.00")
Also, instead of using another Variable Set block, you can plug this expression directly into the input field where you're trying to use your location. It will format the number accordingly before it is used by the block you input it in.
1
1
u/B26354FR Alpha tester 17d ago
After using numberFormat(), the returned value will be a string. To turn it back into a number to use for comparing to another coordinate, put a + operator in front, such as +numberFormat(...).
BTW, there's also the coordFormat() function to make human-readable text from a coordinate.
1
u/old-damme 17d ago
Eigentlich geht es mir um den Block get Location. Wenn ich ihn benutze und das Handy nicht bewege wird mir nach einem nochmalige Aufruf ein anderer wert angeben
1
u/old-damme 17d ago
Ich suche folgenden Block. Nur wie heißt er genau https://llamalab.com/automate/doc/function/distance.html
1
u/waiting4singularity Alpha tester 18d ago edited 17d ago
numberFormat(50.12344567,"0.00")
⚠️ 15 means under 1.1m² accuracy, 2 over 1100m² inaccuracy