Jump to content

concatenate


Recommended Posts

I am trying to get fields to concatenate in “capture web form†for new record and to “edit web form†in an update form in a footer with no luck. I got this script from the caspio community forum. Is there anything anyone can see that I am doing wrong? I am a Java novice.

This is the capture form footer.

function concatenate()

{

//(1) Retrieve the value of the field Catagory and store in a variable Catagory.

var Catagory = document.forms[0].InsertRecordCatagory.value;

//(2) Retrieve the value of the field Business_Name and store in a variable Business_Name.

var Business_Name = document.forms[0].InsertRecordBusiness_Name .value;

//(3) Retrieve the value of the field Description and store in a variable Description.

var Description = document.forms[0].InsertRecordDescription.value;

//(4) Retrieve the value of the field Details and store in a variable Details.

var Details = document.forms[0].InsertRecordDetails.value;

//(5) Create the string and define a variable with that value.

var Keyword = Business_Name+Catagory+Description+Details;

//(6) Post the string to the targeted field.

document.getElementById(\"InsertRecordKeyword\").value = Keyword;

}

//(5) On submitting the webform, the function calculate is executed.

document.forms[0].onsubmit=concatenate;

Also Trying to allow this field to be changed when the record is edited.

Script for Editing record and concatenate. Tried to select field from [ ] box in HTML block and still did not work.

function concatenate()

{

//(1) Retrieve the value of the field Catagory and store in a variable Catagory.

var Catagory = document.forms[0].EditRecord[@field:Catagory].value;

//(2) Retrieve the value of the field Business_Name and store in a variable Business_Name.

var Business_Name = document.forms[0].EditRecord[@field:Business_Name] .value;

//(3) Retrieve the value of the field Description and store in a variable Description.

var Description = document.forms[0].EditRecord[@field:Description].value;

//(4) Retrieve the value of the field Details and store in a variable Details.

var Details = document.forms[0].EditRecord[@field:Details].value;

//(5) Create the string and define a variable with that value.

var Keyword = Business_Name+Catagory+Description+Details;

//(6) Post the string to the targeted field.

document.getElementById(\"InsertRecordKeyword\").value = Keyword;

}

//(5) On submitting the webform, the function calculate is executed.

document.forms[0].onsubmit=concatenate;

Link to comment
Share on other sites

Hi John,

Try the following in the Capture Web Form footer:

function concatenate()

{

var Catagory = document.getElementById(\"InsertRecordCatagory\").value;

var Business_Name = document.getElementById(\"InsertRecordBusiness_Name\").value;

var Description = document.getElementById(\"InsertRecordDescription\").value;

var Details = document.getElementById(\"InsertRecordDetails\").value;

var Keyword = Business_Name+Catagory+Description+Details;

document.getElementById(\"InsertRecordKeyword\").value = Keyword;

}

document.getElementById(\"caspioform\").onsubmit=concatenate;

Notice that after InsertRecord prefix you need to have your corresponding field names.

For the Update form use the following code:

function concatenate()

{

var Catagory = document.getElementById(\"EditRecordCatagory\").value;

var Business_Name = document.getElementById(\"EditRecordBusiness_Name\").value;

var Description = document.getElementById(\"EditRecordDescription\").value;

var Details = document.getElementById(\"EditRecordDetails\").value;

var Keyword = Business_Name+Catagory+Description+Details;

document.getElementById(\"EditRecordKeyword\").value = Keyword;

}

document.getElementById(\"caspioform\").onsubmit=concatenate;

The only difference between these two JS is that in Web Form fields are referenced by InsertRecord prefix and in Update form ther are referenced by EditRecord prefix.

Good Luck!

Barbara

Link to comment
Share on other sites

  • 2 weeks later...

Barbara,

I pasted your code directly into my footer. When I edited my files and tried to enter new ones, the field \"Keyword\" is left blank in my data table. I am not sure what I'm doing wrong. Anyone have any ideas???

Ultimately, I am trying to create a Keyword search field to search several variables at once. This allows me to screen by location and keyword using the \"contains\" option for comparison.

Thanks,

John

Link to comment
Share on other sites

Hi John,

Everything seems ok unless category field name, make sure all the field names match exactly with what you have in the table and make sure there is no typo.

If you give me the URL of your DataPage I could see in firefox/firebug if there is any JS error.

---------

Barbara

Link to comment
Share on other sites

  • 2 months later...

I am trying this and its not working.

I am trying this in a webform BUT if I was to try in what footer (there are 3 options) in the Search & Report form do I put it in? Does it go in the "Configure Search Fields" footer or the "Configure Results Page Fields" or the "Configure Details Page" (Yes I understand that the code is slightly diffrent if it is in a webform instead of search).

(other info to help you help me) I added a field in my table named "Keyword". I am hoping to put these combined fields into that field so I can search on it. Also the name of my datapage is "testClientsWebForm".

The script is copied below. I have double checked for typos but I don't see my mistake.

help... anyone

function concatenate()

{

var ClientName = document.getElementByIdInsertRecordClientName.value;

var ClientAddress = document.getElementByIdInsertClientAddress.value;

var ClientCity = document.getElementByIdInsertClientCity.value;

var ClientState = document.getElementByIdInsertClientState.value;

var ClientZip = document.getElementByIdInsertRecordClientZip.value;

var Keyword = ClientName+ClientAddress+ClientCity+ClientState+ClientZip;

document.getElementByIdKeyword.value = Keyword;

}

document.getElementByIdtestClientsWebForm.onsubmit=concatenate;

Link to comment
Share on other sites

Thanks for your help on this but still no luck. I fixed the errors I made.

I am wondering if I am not understanding a particular part of this. I am thinking that this gathers that fields together to make a string and then actually puts it into a field... in this case that field is called keyword. Is that right?

FYI... I am putting this script in the footer of a form. The table for that form has a field named Keyword. I have tried it with and without that field in the form. I have also tried the two scripts below but both don't work.

function concatenate()

{

var ClientName = document.getElementById(InsertRecordClientName).value;

var ClientAddress = document.getElementById(InsertRecordClientAddress).value;

var ClientCity = document.getElementById(InsertRecordClientCity).value;

var ClientState = document.getElementById(InsertRecordClientState).value;

var ClientZip = document.getElementById(InsertRecordClientZip).value;

var Keyword = ClientName+ClientAddress+ClientCity+ClientState+ClientZip;

document.getElementById(InsertRecordKeyword).value = Keyword;

}

document.getElementById(testClientsWebForm).onsubmit=concatenate;

------------------------ ----------- --------------------

function concatenate()

{

var ClientName = document.getElementById(\"InsertRecordClientName\").value;

var ClientAddress = document.getElementById(\"InsertRecordClientAddress\").value;

var ClientCity = document.getElementById(\"InsertRecordClientCity\").value;

var ClientState = document.getElementById(\"InsertRecordClientState\").value;

var ClientZip = document.getElementById(\"InsertRecordClientZip\").value;

var Keyword = ClientName+ClientAddress+ClientCity+ClientState+ClientZip;

document.getElementById(\"InsertRecordKeyword\").value = Keyword;

}

document.getElementById(\"testClientsWebForm\").onsubmit=concatenate;

Link to comment
Share on other sites

Sorry, my mistake, you need to enclose them within " " and also the last line needs to be changed to "caspioform" so it looks like:

function concatenate()

{

var ClientName = document.getElementById("InsertRecordClientName").value;

var ClientAddress = document.getElementById("InsertRecordClientAddress").value;

var ClientCity = document.getElementById("InsertRecordClientCity").value;

var ClientState = document.getElementById("InsertRecordClientState").value;

var ClientZip = document.getElementById("InsertRecordClientZip").value;

var Keyword = ClientName+ClientAddress+ClientCity+ClientState+ClientZip;

document.getElementById("InsertRecordKeyword").value = Keyword;

}

document.getElementById("caspioform").onsubmit=concatenate;

This should work.

Best,

Bahar M.

Link to comment
Share on other sites

  • 1 month later...

Is it possible to make an Excel Form to filter and concatenate cells?

I have an excel workbook with many worksheets. In each worksheet are the different parts of an ID.

Is it possible to create a form in excel to prompt users to answer questions and based on those questions filter out unneed cells and concatenate the left overs to make a unique ID?

Link to comment
Share on other sites

  • 2 months later...

Hey folks,

I too am having similar issues with Concatenation. I have copied the samples that were posted here and am having very little luck.

I have placed this script in the footer of my input form. I have a field called "Email_Cell" and that is where I want the concatenation to be applied. I am trying to combine "CellPhone" and "CellPhoneCarier" to the "Email_Cell" field.

1. Do I have to make sure the "Email_Cell" field is visible or hidden or not even used in the form?

2. Does the "Email_Cell" field have to be of a specific type: TextField or TextArea?

3. None of the above... ; )

----------------

function concatenate()

{

var CellPhone = document.getElementById("InsertRecordCellPhone").value;

var CellPhoneCarier = document.getElementById("InsertRecordCellPhoneCarier").value;

var Email_Cell = CellPhone+CellPhoneCarier;

document.getElementById("InsertRecordEmail_Cell").value = Email_Cell;

}

document.getElementById("caspioform").onsubmit=concatenate;

-----------------

Link to comment
Share on other sites

Ok, I tried something else and it worked! No java needed.

I created a table and an entry form, into that table, that contained cell phone number plus a drop down field containing all the email suffixes for all cell phone companies : "@txt.att.net" plus all others.

I also created an extra field in the table that the concatenated data will be appended to: "Email_Cell"

In the configure fields page, I changed the field, Email_Cell to a hidden field and used a default perameter of: "[@CellPhone][@CellPhoneCarier]; [@Email];" -->just the info inside the quotes.

The result worked!! I now have their cell phone and email address getting the confirmation email that Caspio sends out.

I hope this is useful to anyone out there.

Regards,

Qsworld

Link to comment
Share on other sites

  • 1 year later...

Help! I am wondering if the latest updates are not allowing these scripts to work or if I am missing something. I am gone over them several times but cant figure out what I am doing wrong.

Any ideas?

------- The Script below I am putting in a reguilar FORM in the footer --------

function concatenate()

{

var FirstName = document.getElementById("InsertRecordFirstName").value;

var LastName = document.getElementById("InsertRecordLastName").value;

var City = document.getElementById("InsertRecordCity").value;

var Industry = document.getElementById("InsertRecordIndustry").value;

var Felony = document.getElementById("InsertRecordFelony").value;

var Misdemeanors = document.getElementById("InsertRecordMisdemeanors").value;

var WhatShift = document.getElementById("InsertRecordWhatShift").value;

var HighlightSummary = FirstName+LastName+City+Industry+Felony+Misdemeanor+WhatShift;

document.getElementById("InsertRecordHighlightSummary").value = HighlightSummary;

}

document.getElementById("caspioform").onsubmit=concatenate;

--------- Script Below I am putting in a SEARCH & REPORT in the footer of the details page -------

function concatenate()

{

var FirstName = document.getElementById("EditRecordFirstName").value;

var LastName = document.getElementById("EditRecordLastName").value;

var City = document.getElementById("EditRecordCity").value;

var Industry = document.getElementById("EditRecordIndustry").value;

var Felony = document.getElementById("EditRecordFelony").value;

var Misdemeanors = document.getElementById("EditRecordMisdemeanors").value;

var WhatShift = document.getElementById("EditRecordWhatShift").value;

var HighlightSummary = FirstName+LastName+City+Industry+Felony+Misdemeanor+WhatShift;

document.getElementById("EditRecordHighlightSummary").value = HighlightSummary;

}

document.getElementById("caspioform").onsubmit=concatenate;

Link to comment
Share on other sites

  • 9 years later...

 

Hi @johntgorman,

As of July 12, 2018, Caspio introduced new features which you can find here: https://howto.caspio.com/release-notes/caspio-bridge-13-0/

This release includes a new feature, Calculated Values in Submission Forms.  This allows you to generate calculations which you can use for you to concatenate your values. 

Check these videos for more information:

I hope this helps!

Link to comment
Share on other sites

  • 2 weeks later...

Hi.  Just to add to the previous comment above,  In the new release of Caspio version 17.0 , you can now add the Calculated Value form element to Update Forms and Details Pages to generate dynamic calculations as users interact with your forms. Previously, this feature was only available in Submission Forms. You may also check this link about calculated value: https://howto.caspio.com/datapages/datapage-components/calculated-values/

Also, you can Concatenate two or more fields in your Table using a Formula field and you can use that formula field in your Power search.

Concatenate.thumb.png.ffed362c2843b64666bb8f9263a08e5e.png

 

You may also check this link: https://howto.caspio.com/tables-and-views/data-types/formula-fields/

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...
 Share

×
×
  • Create New...