Jump to content

Request Feature: Concatenation (Combining) Fields


Recommended Posts

There are SOOOO many ways that having concatenation as a tool choice within Caspio Bridge would be invaluable ... combining first + last names... combining area codes with phone numbers... putting labels with data.

I think it ranks with aggregates & calculated fields, but should be in the Submission and Update forms to create combined fields directly into the database, not just in reports/views.

This combining can be done by exporting to excel and re-importing, but that negates a basic value of the Caspio system in that data is automatically updated with each form submission - not the case if you have to export and re-import.

Please oh please oh please!!!!! If I knew more about programming, I'd be able to do this on my own better.

I did find this http://forums.caspio.com/viewtopic.php?f=14&t=12233&start=0&hilit=Insertrecord but can't get it to work.

Link to comment
Share on other sites

Hi Kristy,

We hear you, the feature is added to the feature request database and will be reviewed by the product team for future consideration.

For now, you can write Java Script or have Caspio write the script for your application. To have Caspio write it for you please contact support to get price quote. If you have followed the instruction at viewtopic.php?f=14&t=12233&start=0&hilit=Insertrecord and cannot get it to work you can provide the DataPage URL and the code that you have pasted in the footer so I can see what might be wrong.

Best,

Bahar M.

Link to comment
Share on other sites

I tried the following however I cannot get the two fields to concatenate:

function concatenate()

{

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

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

var FullName = FirstName+LastName;

document.getElementByID("EditRecordTA_Full_Name").value = FullName;

}

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

Any suggestions?

Thanks,

Chris

Link to comment
Share on other sites

Looks like you're making the same mistake I did by putting your field name every place it says position1, position2 or allpositions. What I learned is that where they appear after the "var" word they are instructions for the coding and should stay put in those locations. Therefore, the only places where you insert your specific field names is within the parenthesis following the phrase = document.getElementById

I assume you are using it on an Update form or Search&Report Data Page since you replaced the InsertRecord with EditRecord.

Also, if you want a space between the two bits of information you're concatenating, and I assume you would with a name, you need to add code for it in between position1 and position2 in the var allpositions line. I added this in the code below (the + " " + bit where the space or other data you want added is between the quotation marks). Otherwise the name will print as JoeSmith instead of Joe Smith.

This set up worked for me - I just inserted your fieldnames and changed InsertRecord to EditRecord as you had in your sample.

Hope this works for you :) !

_______________________________________________________

function concatenate()

{

var position1 = document.getElementById("EditRecordTA_First_Name").value;

var position2 = document.getElementById("EditRecordTA_Last_Name").value;

var allpositions = position1 + " " + position2;

document.getElementById("EditRecordTA_Full_Name").value = allpositions;

}

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

Link to comment
Share on other sites

  • 11 months later...

I can't get concatenation to work on multiple phone numbers on one form - I can only get one group of 4 groups of concatenated phone numbers to work at a time. When I label "var allpositions" with separate numbers (1, 2, 3, 4) only the last one works. When I remove the numbers from the "var allpositions" so they're all labeled the same, then only the first one works. The inserted punctuation (where I've inserted parentheses and spaces into the resultant phone number) do work on in the concatenated field (PH_1, 2, 3 and 4) but it's not pulling in the data from the fields.

function concatenate()

{

var position1 = document.getElementById("InsertRecordPhone1_ID").value;

var position2 = document.getElementById("InsertRecordPhone1_AC").value;

var position3 = document.getElementById("InsertRecordPhone1").value;

var allpositions1 = position1 + " " + "(" + position2 + ")" + " " + position3;

document.getElementById("InsertRecordPH_1").value = allpositions1;

}

function concatenate()

{

var position4 = document.getElementById("InsertRecordPhone2_ID").value;

var position5 = document.getElementById("InsertRecordPhone2_AC").value;

var position6 = document.getElementById("InsertRecordPhone2").value;

var position7 = document.getElementById("InsertRecordPh2Ext").value;

var allpositions2 = position4 + " " + "(" + position5 + ")" + " " + position6 + " " + position7;

document.getElementById("InsertRecordPH_2").value = allpositions2;

}

function concatenate()

{

var position8 = document.getElementById("InsertRecordPhone3_ID").value;

var position9 = document.getElementById("InsertRecordPhone3_AC").value;

var position10 = document.getElementById("InsertRecordPhone3").value;

var position11 = document.getElementById("InsertRecordPh3Ext").value;

var allpositions3 = position8 + " " + "(" + position9 + ")" + " " + position10 + " " + position11;

document.getElementById("InsertRecordPH_3").value = allpositions3;

}

function concatenate()

{

var position12 = document.getElementById("InsertRecordPhone4_ID").value;

var position13 = document.getElementById("InsertRecordPhone4_AC").value;

var position14 = document.getElementById("InsertRecordPhone4").value;

var position15 = document.getElementById("InsertRecordPh4Ext").value;

var allpositions4 = position12 + " " + "(" + position13 + ")" + " " + position14 + " " + position15;

document.getElementById("InsertRecordPH_4").value = allpositions4;

}

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

Link to comment
Share on other sites

  • 2 weeks later...

Hi Kristy,

You have four functions with the same name "concatenate", for example rename them on concatenate1, concatenate2, concatenate3 and concatenate4.

Than replace

document.getElementById("caspioform").onsubmit=concatenate;
with the following code:

document.getElementById("caspioform").onsubmit = function(){concatenate1(); concatenate2(); concatenate3(); concatenate4();}

Let me know if this helps.

Link to comment
Share on other sites

  • 6 years later...

Hi all,

 

Just to give you an update, calculation in submission form is now available. You can concatenate two fields without using JavaScript. You can use Calculated Value as Form Element. 

For more information about Calculated Value, please refer to this link: https://howto.caspio.com/datapages/datapage-components/calculated-values/

 

Regards,

kristina

 

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