Jump to content

Horizontal Scale and Vertical Text


Recommended Posts

Please forgive me I am very new to FusionPro and I am trying to combine several rules together. I need my rule to select the first 3 positions of a field, horizontal scale it and set it vertically. So far my code can select the first 3 positions and horizontal scale it. But when I try to add in the Vertical code it dismisses the selection of the first 3 characters or is voided with adding to the top or bottom of my code. My current code that selects the first 3 and horizontal scales is:

 

if(Field("No_Only")!="")

return '<setwidth newsize="53.6">' + Left(Field("No_Only"), 3,3);

 

______________________________________________________________

 

When I add the below to the top of my code it dismisses the 3 position selection and when I add the code below it is ignored.

 

__________________________________________________________

 

retstr = "";

 

for (i = 0; i <= Field("No_Only").length; i++)

{

if (Left(Field("No_Only"),i,1) == " ")

retstr = retstr + "<p>"

else

retstr = retstr + Left(Field("No_Only"),i,1) + "<p>"

}

return retstr;

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

I'm not sure I understand what you're trying to do. Maybe you could post an image of what you're trying to achieve?

 

I can tell you, though, that the "Left" function only takes two arguments – the string and the number of characters to return. So, to return the 3 leftmost characters, your function would merely be:

var str = 'Stephen';
return [color="Red"]Left(str, 3);[/color] // returns 'Ste'

 

No third argument needed.

 

retstr = "";

for (i = 0; i <= Field("No_Only").length; i++)
{ 
if (Left(Field("No_Only"),i,1) == " ")
retstr = retstr + "<p>"
else
retstr = retstr + Left(Field("No_Only"),i,1) + "<p>"
}
return retstr;

I can't tell what you're trying to achieve here. Are you just trying to separate every character with a paragraph tag? You could do that like so:

return Field("No_Only").split('').join('<p>');

Link to comment
Share on other sites

mid function can be used too....

 

var a = Mid(YOURFIELD,1,1)
var b = Mid(YOURFIELD,2,1)
var c = Mid(YOURFIELD,3,1)

return a+<p>+b+<p>+c

// have return return strings as tagged text checked.

 

or to make it more dynamic...

 

var howMany = 3
var collectText = ""

for (c = 0; c < howMany; c++)
collectText += Mid(YOURFIELD,c+1,1)+"<p>";

return s;

// have return return strings as tagged text checked.

Link to comment
Share on other sites

Stephen displays as

 

S

t

e

 

Oh okay, well it sounds like you'd be able to do that with only this line of code:

return Left(Field("No_Only"), 3).split('').join('<p>');

 

Just keep in mind that the "Left" function literally grabs the first 3 characters in a string so if your field happens to start with 2 spaces (" stephen"), the result will be 2 empty lines and an "s". If you want to prevent that from happening you can do so using the "LTrim" function to remove extra spaces from the beginning of the string:

return Left(LTrim(Field("No_Only")), 3).split('').join('<p>');

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