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

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 24th, 2015, 10:46 AM
rjhansen rjhansen is offline
Junior Community Member
 
Join Date: Feb 2015
Location: Oklahoma City
Posts: 18
Default drag and drop rule problem

I'm new to FusionPro. I'm trying to create a simple rule using Drag and Drop. I have a series of numbers (1-100) printing on cards. I want the single digit numbers to be a larger font size than the double digit numbers. My data file only has one field, "TableNo".

I have the following:

If "Numeric value of" "TableNo" (my field) is less than "10"
Then Return "FusionProRuleWizard.Action.Change Point Size"

I'm specifying 250 pts for the point size change. When I try to insert the rule, the rule itself is printing on the page with the data and is not changing the font size as expected.

I've looked at at the documentation and searched the forums but haven't been able to figure out what I'm doing wrong.
Reply With Quote
  #2  
Old February 25th, 2015, 10:36 AM
FreightTrain's Avatar
FreightTrain FreightTrain is offline
Learning Development Manager
 
Join Date: Oct 2008
Location: Solana Beach, CA
Posts: 326
Default Re: drag and drop rule problem

rjhansen,
Drag and drop is probably not the best way to accomplish this. Try an empty rule with the content below.
Quote:
if (Field("TableNo") < "10")

return '<z new size="250">'+Field("TableNo");

else
return Field("TableNo");
2 important things to remember:
  1. Make sure you check the box at the top of the rule menu for "Treat return strings as tagged text".
  2. When you insert the rule the font size should be the desired size for everything > 10.
__________________
Richard A. Lewis, Jr.
Learning Development Manager | MarcomCentral® a Ricoh Company
Reply With Quote
  #3  
Old February 25th, 2015, 11:39 AM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 957
Default Re: drag and drop rule problem

I agree that this would be easier to accomplish through a custom rule, but I think the rule as it stands is comparing a string to a string which seems like it would throw off the comparison between the two numbers. I think you probably want to re-write the if statement condition (first line) to be:
Code:
if (StringToNumber(Field("TableNo")) < 10)
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #4  
Old February 25th, 2015, 12:24 PM
tobarstep tobarstep is offline
Regular Contributor
 
Join Date: Sep 2008
Location: Florida
Posts: 71
Default Re: drag and drop rule problem

I've never used the drag and drop before, but I whipped up a quick sample and it worked as intended. I'm attaching a jpg screenshot of what my rule looked like in the drag and drop editor window (my field name was "Qty_S" and I used 25pt font, but you get the idea).

After I saved the rule I inserted it into a text frame and it worked fine. Incidentally, if you put in the rule that way and then click the button to convert the rule to JavaScript you get essentially the combination of what users FreightTrain and step posted.
Attached Images
File Type: jpg 2-25-2015 2-03-04 PM.jpg (10.1 KB, 8 views)
__________________
FusionPro VDP 9.3.12 Desktop/Server
Windows 7 Enterprise / Windows Server 2008 r2
Acrobat X
Reply With Quote
  #5  
Old February 25th, 2015, 01:31 PM
rjhansen rjhansen is offline
Junior Community Member
 
Join Date: Feb 2015
Location: Oklahoma City
Posts: 18
Default Re: drag and drop rule problem

Thanks for all the input! Definitely very helpful, but I'm still having issues getting this to work. Straight off, using FreightTrain's code didn't change the point size. I suspected I needed the StringToNumber function, but I was calling it wrong. Step's suggestion showed the correct usage, but my rule still didn't work correctly.

Then I tried recreating tobarstep's Drag And Drop rule. This didn't change my point size either. Then I converted that to JavaScript and made a couple of changes and now I've got something that changes the point size on 1-9 (as expected) but it also prints the same digit at the original point size right beside the larger number. Here's the rule:

if (StringToNumber(Field("TableNo")) < StringToNumber("10"))
{
return "<span pointSize=230>" + TaggedDataField("TableNo") + "</span>";
}

return "";

And a screenshot of the first record as it previews with this rule inserted:

Reply With Quote
  #6  
Old February 25th, 2015, 01:59 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 957
Default Re: drag and drop rule problem

It sounds like your text frame is returning your rule as well as the variable. You should set the contents of your text frame to only return the contents of the rule and the change your rule to:
Code:
if (StringToNumber(Field("TableNo")) < 10){
	return "<span pointSize=230>" + TaggedDataField("TableNo") + "</span>";
}
else {
	return TaggedDataField("TableNo");
}
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #7  
Old February 25th, 2015, 02:33 PM
rjhansen rjhansen is offline
Junior Community Member
 
Join Date: Feb 2015
Location: Oklahoma City
Posts: 18
Default Re: drag and drop rule problem

Thanks Step, I suspected the same thing, but can't figure out how to fix that. Unfortunately, your suggested revision yields the same result.
Reply With Quote
  #8  
Old February 25th, 2015, 03:09 PM
rjhansen rjhansen is offline
Junior Community Member
 
Join Date: Feb 2015
Location: Oklahoma City
Posts: 18
Default Re: drag and drop rule problem

Step, you said "You should set the contents of your text frame to only return the contents of the rule…"

How do I do that?
Reply With Quote
  #9  
Old February 25th, 2015, 03:23 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 957
Default Re: drag and drop rule problem

Can you collect your template and post it to the forum with the data? It's really difficult to figure out the problem without seeing all of the factors that come into play.
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #10  
Old February 25th, 2015, 04:07 PM
rjhansen rjhansen is offline
Junior Community Member
 
Join Date: Feb 2015
Location: Oklahoma City
Posts: 18
Default Re: drag and drop rule problem

Here's my files.
Attached Files
File Type: zip TableNos.zip (6.0 KB, 9 views)
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:50 PM.


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