concatenation

For issues related to understanding the basics, system terminology, and becoming familiar with SmartBuilder

Moderators: Rob Penn, Leif

concatenation

Postby maximise » Sun Mar 04, 2012 9:27 am

The next obvious question is if a student enters both 'first name' and 'surname' as two separate fields is there then a simple way to concatenate both names on the certificate page?

Obviously I will want the 'first name' separate when I come to give personal feedback using the 'first name' only.
maximise
 
Posts: 41
Joined: Sat Feb 04, 2012 4:09 am

Re: concatenation

Postby Nav » Mon Mar 05, 2012 12:02 pm

Hi,
What was the first question that is the next question to...? In any case, yes, it is pretty easy to concatenate names. You'll need a variable. Let's assume you've got a couple input text objects on the page as well as a final regular text object to show the compiled name. When they are done entering their name, they'll click a button or something. Then you'll set the variable to the first name, append a space and the last name, and then update your output text object. Here's how you'd get those working.

Trigger: Submit Button > onClick
Response: Global Variables > Text > Full Name > setValue > Function > First Name Input Text > getText
Response: Global Variables > Text > Full Name > append > [space] ; Function > Last Name Input Text > getText
Response: Name Output text > setText > Function > Global Variables > Text > Full Name > getValue

Here's what that second response looks like if you're not familiar with the append function:

name.png
name.png (27.23 KiB) Viewed 16436 times

Let me know if anything is unclear.

- Nav
Nav
 
Posts: 866
Joined: Mon Nov 05, 2007 2:58 pm

Re: concatenation

Postby Nav » Mon Mar 05, 2012 12:06 pm

Oh, if you want to access just the first name, then you can get that directly from the input text object. Or store it in a variable if you're going to be capturing it on one page, and then displaying it on another page. I don't really know your familiarity with Variables, so I don't know if this is making sense... Have you seen the video tutorials on Dynamic Values (http://help.smartbuilder.com/node/223) and Variables (http://help.smartbuilder.com/node/224)? They'll definitely help here.

For example:
Trigger: Final Feedback > onShow
Response: Final Feedback > Passing Feedback > Name Text Object > setText > Function > First Name Input Text > getValue

- Nav
Nav
 
Posts: 866
Joined: Mon Nov 05, 2007 2:58 pm

Re: concatenation

Postby maximise » Wed Mar 07, 2012 1:48 pm

Thanks, Your append solution looks right but I'm not sure if my version is the same as yours!
See below:
Image
maximise
 
Posts: 41
Joined: Sat Feb 04, 2012 4:09 am

Re: concatenation

Postby Nav » Wed Mar 07, 2012 2:35 pm

Hi,
It looks like you're setting the Variable to the Variable (replacing the value with itself). You should be setting the Text object to Variable value. It might be confusing because your Text object has the same name as your Variable. I usually like to name my variable like "fullNameVar" to avoid confusion.

Response: Text object > setText > Variable > getValue

- Nav
Nav
 
Posts: 866
Joined: Mon Nov 05, 2007 2:58 pm

Re: concatenation

Postby maximise » Thu Mar 08, 2012 12:25 pm

Oh Dear! I've spent another 4 hours going over and over this concatenation. I have the three variables, fname, Surname and Full-name. the display text is Full-Name (both capitalised). I've followed the previous instructions although on the first response, for instance the final 'get text' only gives mw the option of 'get value'.

I respectfully linke the three responses as below. If anyone can help I'd be most grateful:
Image
Image
Image
maximise
 
Posts: 41
Joined: Sat Feb 04, 2012 4:09 am

Re: concatenation

Postby Nav » Thu Mar 08, 2012 1:25 pm

Hi,
It's still a little mixed up, which is why it isn't working. You're never actually updating the text object. It's only ever trying to GET information from the text object (the way that you have it set up right now). Change the variable and text object names will make the errors jump off the page.

I've tried to recreate what you've set up and explain how to change it in this video. http://screencast.com/t/IAeMLgczZmi

I noticed there was a small error with the space being ignored even after fixing it (my fault for not anticipating it earlier), and here's how to fix that: http://screencast.com/t/fIdtsFT1ghM

If that doesn't fix it, we should do a gotomeeting. Please email support @ suddenlysmart and we can set one up.

- Nav
Nav
 
Posts: 866
Joined: Mon Nov 05, 2007 2:58 pm

Re: concatenation

Postby maximise » Thu Mar 08, 2012 4:11 pm

Hi, Nav,It's now 11.10 at night and I'm still struggling. I think that the problem is something strange going on with the data capture function. - Append appears to be working correctly with two names entered into the variable list.
*If I enter names into the variables list they display correctly on the final page and centred (even with long surnames) - Perfect!
*If I enter a first name only on the front page - the first name displays and centred
*If I enter a surname only on the front page - nothing displays
*If I enter both names on the front page - nothing displays

Must go to bed!
maximise
 
Posts: 41
Joined: Sat Feb 04, 2012 4:09 am

Re: concatenation

Postby maximise » Fri Mar 09, 2012 6:16 am

Hi guys, cracked it at last! All nicely centred and concatenated!
Attachments
cracked it!.jpg
cracked it!.jpg (142.79 KiB) Viewed 16425 times
maximise
 
Posts: 41
Joined: Sat Feb 04, 2012 4:09 am


Return to Getting Started

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Not able to open ./cache/data_global.php