Jump to content

Use Part Of A Fields Data


Recommended Posts

I have a weight scale that outputs data like a keyboard, however, it outputs a 20 character string, and i only want to use characters 4 through 13, is there a way i can isolate just these characters in a number field??

Example: 

Scale output: "w:+    50.000lb     "
What i want to save in a number field "50.000"

please let me know what i need to do.

Link to comment
Share on other sites

Java script can easily handle changing the field as needed.  Here is an example,  Place that in your footer, or at least that is where I use it.  This is assuming it is a Submission form.  If it is an update form change InsertRecord with EditRecord.  This is also assuming your field is called "Weight".  But you can easily change those to match what your fields are called.  Note I have not run this so their may be some syntax errors but I believe it is all correct.

<script>

	function modify()
	{
		//Find elemeny by name as Caspio likes to assign ids that change.  Store the value in the field to weight.
		var weight = document.getElementsByName("InsertRecordWeight")[0].value;
		//Take a substring of weight and store it back into weight.
		weight = weight.substring(4,13);
		//Set the value of the weight field in the form to the new substring 
		document.getElementsByName("InsertRecordWeight")[0].value = weight;
		//the new value in the field is what is submitted.
	}
	//When the form is submitted called method modify.
	document.getElementById("caspioform").onsubmit=modify;
</script>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...