Jump to content

Space Above in FusionPro Rule


Recommended Posts

Hello

 

 

I am trying to set up a rule in FusionPro where a specific instance gets a different space above value than others and am having some trouble.

 

 

There will be multiple options for a user to select and some options include text that is larger than others (so this messes with the paragraphs space above value in the text editor. For whatever reason.)

 

 

Have a look at my code:

 

 

if(Field("Design 1") == "Black" || Field("Design 1") == "Gold" || Field("Design 1") == "Gray" || Field("Design 1") == "Emerald"

|| Field("Design 1") == "White" || Field("Design 1") == "Navy" || Field("Design 1") == "Blue")

{

return (Field("Design 1")) + "<superscript>TM</superscript>" + '<f name= "LainieDaySH">' + '<z newsize="15">' + "<color rgb=c59617> Luxury</color>" + '</f>' ;

}

else

{

return '<p leadbefore= 3>' + (Field("Design 1")) + "<superscript>TM</superscript>" + '>';

}

 

 

The section in question is highlighted in dark red. The options above, if selected, will add the word "luxury" in a larger font as you can see in the code. When the "else" (dark red) options are chosen, they are not lining up where i want them to be on the document. I am assuming this is because of the font size increase.

I have tried the <p leadbefore= > tag but have been unsuccessful with it so far. I also saw another thread here: http://forums.pti.com/showthread.php?t=4395 but it was confusing and i didnt exactly understand what this part was for (Int(Field("SpaceAbove")) * 7200). Is there something that i am missing from that tag? Is there another way to do this?

Thank you.

Link to comment
Share on other sites

I am trying to set up a rule in FusionPro where a specific instance gets a different space above value than others and am having some trouble.

 

 

There will be multiple options for a user to select and some options include text that is larger than others (so this messes with the paragraphs space above value in the text editor. For whatever reason.)

This is kind of hard for me to visualize just from the description. A picture (screenshot) might be worth a thousand words here. A collected template which reproduces what you're seeing would be even better.

Have a look at my code:

 

 

if(Field("Design 1") == "Black" || Field("Design 1") == "Gold" || Field("Design 1") == "Gray" || Field("Design 1") == "Emerald"

|| Field("Design 1") == "White" || Field("Design 1") == "Navy" || Field("Design 1") == "Blue")

{

return (Field("Design 1")) + "<superscript>TM</superscript>" + '<f name= "LainieDaySH">' + '<z newsize="15">' + "<color rgb=c59617> Luxury</color>" + '</f>' ;

}

else

{

return '<p leadbefore= 3>' + (Field("Design 1")) + "<superscript>TM</superscript>" + '>';

}

First, putting on my moderator hat, when posting code, I recommend clicking the "Go Advanced" button, then using the "code" (#, pound sign, or hash tag) button to put it into a Code block.

 

I think the problem is the number 3 above, in your '<p leadbefore= 3>' tag.

 

As I note in the thread you quote below:

Where the value specifies hundredths of points (of which there are 7200 per inch). If the field value is in inches, you can do this:

return '<p leadbefore="' + (Int(Field("SpaceAbove")) * 7200) + '">';

It's not clear how much space you're trying to add, but by specifying 3, you're really only adding three one-hundredths of an inch of space, which is such a tiny value that it's imperceptible. If you want three inches, you need to specify 3 *7200, or 21600.

 

You should use the trick of creating a Formatted Text Resource, setting the styles you want, then clicking the View Source button, to see what the markup tags are the correspond to what you've selected in the GUI.

 

The section in question is highlighted in dark red. The options above, if selected, will add the word "luxury" in a larger font as you can see in the code. When the "else" (dark red) options are chosen, they are not lining up where i want them to be on the document. I am assuming this is because of the font size increase.

Well, it could be. But it's hard to tell without seeing the job.

 

Also, what leading mode are you using? You can check this by going into the Global Paragraph Paragraph dialog (from the Text Editor, click on Paragraph to get to the Paragraph Formatting dialog, then click on Global Settings). If it's set to Legacy, you may have better results in general by selecting a newer mode, such as FusionPro 9.3.

I have tried the <p leadbefore= > tag but have been unsuccessful with it so far. I also saw another thread here: http://forums.pti.com/showthread.php?t=4395 but it was confusing and i didnt exactly understand what this part was for (Int(Field("SpaceAbove")) * 7200). Is there something that i am missing from that tag? Is there another way to do this?

Yes, again, what you missed is that the numbers in the <p> tag are in hundredths of points, which is why you need to multiply the value in inches by 7200.

Link to comment
Share on other sites

Here is a packaged folder containing the job. I didnt want to do this originally to protect brand names, etc. but ill just delete this thread after. The text box in question is the smaller one on the top (i havent added it to all pages yet as i want to get it to work first).

 

 

 

Looking at page 1: Go ahead and cycle through the preview and you will notice that on records one and two (without the larger "luxury" font) that the text does not line up where i want it. But on records 3 & 4, it lines up great because it has the Luxury text.

 

 

I want to add in padding to the record types of one and two so that they also line up.

Edited by web2print
Link to comment
Share on other sites

Here is a packaged folder containing the job. I didnt want to do this originally to protect brand names, etc. but ill just delete this thread after. The text box in question is the smaller one on the top (i havent added it to all pages yet as i want to get it to work first).

Okay, though it's better forum etiquette to leave the post so that others can benefit from it as well, even if you have to dummy out some data. That's what makes this user forum different than a one-to-one communication like Support.

Looking at page 1: Go ahead and cycle through the preview and you will notice that on records one and two (without the larger "luxury series" font) that the text does not line up where i want it. But on records 3 & 4, it lines up great because it has the Luxury series text.

When I compose, it still doesn't line up perfectly, but okay.

I want to add in padding to the record types of one and two so that they also line up.

Well, usually my least favorite response to a question is, Why would you want to do that? But I have to ask anyway: Why are you trying to align the variable text with the static background like that? I would just set the frame to have a white fill, and cover up the static text. Or is that what you're planning to do anyway, after you get things lined up? If so, then I don't see how anyone would care, or even know, if you're off by a milliliter or two here or there.

 

Though, as I said in the previous post, if you really want to adjust things to that level of precision, I would just try to get it to line up visually by adjusting Space Above in the Paragraph Settings directly in the Text Editor. Then when you find out what number works, in points, you can simply multiply that by 100 to use the in the tag.

Link to comment
Share on other sites

When I compose, it still doesn't line up perfectly, but okay.
Yes, I know. But it is a heck of a lot closer than records 1 & 2.

 

 

 

Well, usually my least favorite response to a question is, Why would you want to do that? But I have to ask anyway: Why are you trying to align the variable text with the static background like that? I would just set the frame to have a white fill, and cover up the static text. Or is that what you're planning to do anyway, after you get things lined up? If so, then I don't see how anyone would care, or even know, if you're off by a milliliter or two here or there.
Yes, I plan on giving the frame a white fill. I dont need the text to be exactly perfect but i need it closer that what records 1 & 2 are giving. I agree, nobody would notice, or care if its off by a tiny amount. They will, however, notice when it is off by a good half inch.

 

 

Here is the code that i added from your response yesterday.

else
{
   return '<p leadbefore="' + (Int(Field("Design 1")) * 14400) + '">' + "<superscript>TM</superscript>";
  }

When i change the number in there, it doesnt do anything. I notice no change when i save the rule.

 

 

 

My validation/ return value is this:

<p leadbefore="0"><superscript>TM</superscript>

It is now not returning the actual design name. Just the "TM"

What am i missing here?

Link to comment
Share on other sites

So you quoted this:

Sure, you can get the "space before paragraph", aka "lead before paragraph" value from a data field if you want, something like this:

return '<p leadbefore="' + Int(Field("SpaceAbove")) + '">';

Where the value specifies hundredths of points (of which there are 7200 per inch). If the field value is in inches, you can do this:

return '<p leadbefore="' + (Int(Field("SpaceAbove")) * 7200) + '">';

Then you somehow adapted it to this:

Here is the code that i added from your response yesterday.

else
{
   return '<p leadbefore="' + (Int(Field("Design 1")) * 14400) + '">' + "<superscript>TM</superscript>";
  }

And then this:

My validation/ return value is this:

<p leadbefore="0"><superscript>TM</superscript>

It is now not returning the actual design name. Just the "TM"

What am i missing here?

Well, yeah, the idea of my example from that other thread is that you need to use a field with a number in it, not a field with a value like "Brown Matte" in it. That's not a number, so the Int function returns zero, and you can multiply zero by anything and still get zero. You need to use a actual NUMBER for the space. And of course, if you want the actual field value with the design name, you still need to return that as a string, and not as part of a <p> tag that specifies the space before the paragraph. I'm not sure I can explain this any better, but....

 

You want to do something like this:

return '<p leadbefore=7200>' + (Field("Design 1")) + "<superscript>TM</superscript>" + '>';

Or like this:

var spaceInInches = 0.5;
return '<p leadbefore=' + String(spaceInInches  * 7200) '>' + (Field("Design 1")) + "<superscript>TM</superscript>" + '>';

 

P.S. The other part of the rule, which is like this:

if(Field("Design 1") == "White" || Field("Design 1") == "Brown Matte" || Field("Design 1") == "Black Matte" || Field("Design 1") == "Gray" 
|| Field("Design 1") == "Gray Matte" || Field("Design 1") == "Gold" || Field("Design 1") == "Gold Matte" 
// etc. etc. etc.

Could be greatly reduced with a switch statement, like so:

switch (Field("Design 1"))
{
   case "White":
   case "Brown Matte":
   case "Black Matte":
   // etc.
   // etc.
       return "whatever here":
}

return "whatever else if there's no match";

You could even use the Switch Wizard to create that, without having to type everything in, then you can convert it to JavaScript if you want.

 

This could be reduced even further like so:

var designs =
[
   "White",
   "Brown Matte",
   "Black Matte", 
   // etc.,
   // etc.,
];

if (designs.indexOf(Field("Design 1") >= 0)
   return "whatever here":
//else
return "whatever else if there's no match";

Edited by Dan Korn
Removed brand names
Link to comment
Share on other sites

Could be greatly reduced with a switch statement, like so:

Code:

switch (Field("Design 1")) { case "Black": case "Gold": case "Gray": // etc. // etc. return "whatever here": } return "whatever else if there's no match";

Thanks for the advice. Ill keep that in mind!

 

 

I managed to get the two different records to line up almost exactly where I need them.

 

 

Thanks for all the help. I appreciate it.

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.

×
×
  • Create New...