Select to view content in your preferred language

How do you format integer input in Survey123 Connect?

5340
11
11-05-2019 10:22 AM
BRYANHERRON
Regular Contributor

OK, so in my industry we have what we call Engineering Stationing. Say you have a centerline of a highway and the start of the highway at some road intersection is 0' from the beginning, or 0+00, 100' down the road there's a manhole, that manhole is at engineering Station 1+00. 3000 feet from the beginning of the road there's an intersection, that would be 30+00. This is Engineering Stationing and in Excel the cell formatting is XX+XX so whatever you type in the "+" is always the 3rd digit from the right. Unless you allow for decimals and change the formatting to accommodate. If I put XX+XX into the inputMask column it works ONLY if the input is 4-digits.

So how do I put this into Survey123 for these results on these inputs?

input 1 = 0+01

input 11 = 0+11

input 123 = 1+23

input 1234 = 12+34

input 12345 = 123+45

input 123456 = 1234+56

input 1234567 = 12345+67

0 Kudos
11 Replies
RobertBorchert
Honored Contributor

This is a very good question. and I had to dig into it.

In Pro

when building your table.  Go to the attribute.  Set it as a  long integer. Go the Number Format option

Choose custom and type in your format string.  Make the first set of pound signs at least as long as your longest first part

Test it out. 

Type in your numbers

When you hit enter it will have the plus sign

0 Kudos
BRYANHERRON
Regular Contributor

Yes, same as formatting the cells in Excel, but I am not building an attribute table in Pro or Desktop. I see now that I didn't express that anywhere in the question. Now I need to figure out how to edit the original question.

I am using Survey123Connect to build forms, so I'm building this all in the XLSForm. I can add the formatting in the esri:inputMask column as XX+XX and it works as long as it's a 4 digit #. I can't get it to format regardless the # of digits. Also if the Engineering Station is 1 or 11 the result should maintain the leading zeros.

1 = 0+01

11 = 0+11

111 = 1+11

1111 = 11+11

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Bryan,

You can add # to get to the maximum number of entries on the left side.  Given that text is entered left to right, you would need to have the 0's typed in to ensure proper spacing.

0 Kudos
BRYANHERRON
Regular Contributor

Technically there is no maximum number of digits preceding the "+", but in reality you rarely see more than 4.

Are you just commenting that my initial assessment was correct and that the esri:mask will not recognize the Excel cell formatting the way Excel does and only allows for same number of digits? That's where I was when I posed the initial question. All I'm asking is if anyone knows how to make this happen.

If setting the esri:mask to the maximum number of characters and having the field guys type in 8 characters regardless, I won't bother.

In excel when I custom format cells as XX+XX, an input of 1-9 results in +1, and integers between 10 and 99 result in +10 through +99 and I can live with that. Any integer above 10, up to where excel starts throwing exponents, works perfectly placing the + as the 3rd character from the right.

So back to the poorly ocnveyed meaning of my original question. Can someone show me how to accomplish this excel outcome in Survey123.

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Bryan,

As I've outlined, Survey123 can support an input mask like ####+## to support this entry; however, text entry is left-justified, so you would need to input with leading 0's

0 Kudos
BRYANHERRON
Regular Contributor

Thank you James, but we aren't hearing each other, for whatever reason. Nothing you've said addresses the actual question I have, even after clarifying and restating it again. You aren't getting what I'm saying and I'm not getting anything from your responses that actually address my question. No fault given, I just think we're on different wavelengths. I don't comprehend an "outline" of anything, but a vague restatement of my original discovery of the limitations of the mask and nothing hinting to whether there is any other way to accomplish what I am trying to do, and all I know to do is ask the original question in a different way. So forgive me for my frustration, but we are not communicating in a productive way, at all.

I fully vetted what you have offered in your replies before submitting the original post and I thought it was clear that I was asking for a solution for the outcome I desired, any solution, or conformation that this is currently not possible.

I guess, instead of the following, from the original post...

So how do I put this into Survey123 for these results on these inputs?

input 1 = 0+01

input 11 = 0+11

input 123 = 1+23

input 1234 = 12+34

input 12345 = 123+45

input 123456 = 1234+56

input 1234567 = 12345+67

I should have asked "Is there any way to format an integer question so that regardless of the number of characters typed in, the result. is a two-place decimal with the decimal point replaced with a + sign?". Actually that one sentence should have been the entire post. hehe

0 Kudos
BRYANHERRON
Regular Contributor

James, I just thought of something. Could I use relevance, based on the number of characters input, to choose which mask is used? That way I could use a single digit mask, a 2 digit mask, a 3 digit mask and so on.

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Bryan,

Yes, in theory you could have a separate question for each different length of digit accepted.

To clarify, Survey123 will not allow for what you have exactly described.  It can support, via the input mask, the text pattern of station marking, but the number must be padded with 0's for any number not present (i.e., if you have it set to accept 5 numbers to the left of +, 1+01 needs to be entered as 00001+01).  This is because text is entered from the left with a subsequent character being placed to the right (as you enter text in a word processor), not from the right with each character shifting the previous characters to the right left (as you see a number entered in a calculator).

MikailaBell
Regular Contributor

Hi Bryan, I would try using text fields, for the data you wish to sum. Summing numbers-as-text often gets reported as a bug. When text fields containing numbers are summed, it performs the sum operation in the weird-ass engineering way that you desire. That is not what most people want, so they get told to switch to numeric fields. 

In your case, you want that weird form of addition. So I suggest you try using text fields, to store your numbers, and then perform the sum operation.

Good luck!

0 Kudos