String to Int
BesvaratWithin a workflow I am saving certain field to table. All is working, but on the ones where the format needs to be a number, I am getting a cryptic error so I am assuming it is trying to add text to a number field.
How do I convert it to Int in my workflow. CInt() in my “Create Feature” doesn't seem to work.
"COMBUSTABILITY": cInt($inspectionForm.state.combustibility.value),
-
Looks like you're referencing a value from a form element? Is that a Number form element?
If so, you can simply add .numeric (i.e. $inspectionForm.state.combustibility.value.numeric)
That's how mine works.
0 -
Thanks Aaron,
I think that worked….but now another error has come up. These error messages are very cryptic. Is there a way to debug code line by line with a workflow??
0 -
click settings, thne change log level to debug then open log viewer to view the same messages.
0 -
Thanks Aaron!
0 -
Hi Aaron,
So while I can now run the code with no errors, the values that are in the form are not getting saved in the table. The ones in question are all that are using the .numeric. Any ideas of what might be going wrong?
In my form two of the three attributes get a value typed in, and in the third it is selected from a drop down.
In the table, the format for the fields are all “DOUBLE”. The table is in a secured esri webservice.
The record in the table is saving, and all the text data is saving….it's just these DOUBLE fields that are sitting blank, yet in the form they are all filled in. I'm using .value.numeric to convert them….maybe i should be trying something else??
0 -
This is my code on the “Create Feature” object if it helps any. I've tried both .numeric and .double, but to no avail. I also notice that niether .numeric nor .double show up in the intellisense.
All of this works, except for the middle three: COMBUSTABILITY, OXYGEN and MH_DEPTH
={ "INSP_DATE": $inspectionForm.state.inspectDate.value.value, "DATEWORK": $inspectionForm.state.txtWorkCompletedDate.value, "FACILITYID": $inspectionForm.state.manholeID.value, "LOCATIONDESCRIPTION": $inspectionForm.state.locationDescription.value, "SETTLEMENTAREA": $inspectionForm.state.settlementArea.value, "LOCALMUNICIPALITY": $inspectionForm.state.municipality.value, "DEPOTAREA": $inspectionForm.state.depotArea.value, "INSPECTED_BY": $inspectionForm.state.inspectedBy.value, "COMMENTS": $inspectionForm.state.comments.value, "COMBUSTABILITY": $inspectionForm.state.combustibility.value.numeric, "OXYGEN": $inspectionForm.state.oxygen.value.numeric, "MH_DEPTH":$inspectionForm.state.depotArea.value.numeric, "TOXICITY": $inspectionForm.state.toxicity.value, "CLEANREQ": $inspectionForm.state.cleaningRequired.value, "RAISE_MH": $inspectionForm.state.raise.value, "LOWER_MH": $inspectionForm.state.lower.value, "RAISE_LOWER_AMOUNT":$inspectionForm.state.raiseLowerAmount.value, "REPLACE_LID": $inspectionForm.state.replaceLid.value, "PARGING":$inspectionForm.state.parging.value, "REPLACE_FRAME": $inspectionForm.state.replaceFrame.value, "REPLACE_BRICKS": $inspectionForm.state.replaceBricks.value, "RESET_FRAME": $inspectionForm.state.resetFrame.value, "STEPS_MH": $inspectionForm.state.steps.value, "CHANNEL_OR_BENCHING": $inspectionForm.state.channelOrBenching.value, "CRACKED_WALLS": $inspectionForm.state.crackedWalls.value, "DETERIORATED_WALLS": $inspectionForm.state.deterioratedWalls.value, "INFILTRATION": $inspectionForm.state.infiltration.value, "SAFETY_GRATE": $inspectionForm.state.safetyGrate.value, "LOCATION": $inspectionForm.state.location.value, "PRIORITY": $inspectionForm.state.wrPriority.value }
0 -
I usually put in a series of Set Feature Attributes rather than jamming it all in the Create Feature. Easier to debug. If you open the Create Feature component within log viewer, expand input and locate attributes, can you see what's being inputted into those 3 fields?
Back to my question a while ago, are your 3 form elements Number? If not, the .numeric won't show up. For the dropdown one, you can add a * 1 at the end.
0 -
Hi Aaron,
To be honest, I kind of overlooked the “Number” suggestion, but I have just updated from a “Text Box” to a “Number”. I'm more familiar with Windows Form so saw there was a Text Box I could add and just went with that.
But, that being said it's working now!! Using “Number” and .value.numeric fixed it.
Thanks for your help!!
0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
8 kommentarer