Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 29th, 2017, 02:04 PM
rrdwitt rrdwitt is offline
Regular Contributor
 
Join Date: May 2016
Location: Missouri
Posts: 53
Default Field within quoted text

Hello, can anyone please help with this? I want a field value to appear within quoted literal text. Here is the current rule.

switch (Field("BackCTA").toLowerCase())
case "backCTA.txt".toLowerCase():
return Field("First Name")+ ", Can you believe it's been months already?";


This works just fine as is. Problem is, I want to add the field from the data named "months" so that the final line reads.

case "backCTA.txt".toLowerCase():
return Field("First Name")+ ", Can you believe it's been MONTH FIELD months already?";
Reply With Quote
  #2  
Old November 29th, 2017, 03:15 PM
MeeshKB MeeshKB is offline
Regular Contributor
 
Join Date: Jun 2012
Location: Alberta, Canada
Posts: 64
Default Re: Field within quoted text

Maybe I'm missing a complicating factor here, but could you not just do this...

case "backCTA.txt".toLowerCase():
return Field("First Name")+ ", Can you believe it's been " + Field("MONTH") + " months already?";
__________________
Michelle
Digital Services Coordinator at Rileys (print and electronic services provider) in Alberta, Canada
FusionPro VDP 9.1.0, Windows 7, Acrobat Pro XI , InDesign CS6, Avanti eAccess, EFI Digital Storefront
Reply With Quote
  #3  
Old November 29th, 2017, 03:19 PM
rrdwitt rrdwitt is offline
Regular Contributor
 
Join Date: May 2016
Location: Missouri
Posts: 53
Post Re: Field within quoted text

Yes, that worked perfectly. Thank you!
Reply With Quote
  #4  
Old November 29th, 2017, 03:31 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 957
Default Re: Field within quoted text

Code:
case "backcta.txt":
  return Field("First Name") + ", Can you believe it's been " + Field("Month") + " months already?";
You could also take care of adding an "s" for plural months like this:
Code:
case "backcta.txt":
  var months = Trim(Field("Month")) + " month";
  months += /^(1|one) month$/i.test(months) ? "" : "s";
  return Field("First Name")+ ", Can you believe it's been " + months + " already?";
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #5  
Old November 30th, 2017, 12:46 PM
rrdwitt rrdwitt is offline
Regular Contributor
 
Join Date: May 2016
Location: Missouri
Posts: 53
Default Re: Field within quoted text

Awesome, I like it! Thank you!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:56 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.