Drew H
-
Posts
3 -
Joined
-
Last visited
Posts posted by Drew H
-
-
Sure thing Douglas, I'll send it in.
I know I can accommodate 5 lines in Frame A - the problem is that it won't always be the same 5 lines. This is a business card, and it has Direct, Cell, and Main phone number entries. Users may include all 3 or none - which results in 3 additional variables being pushed into Frame B (where they need to dynamically align left) or staying in Frame A (where they need to align right).
-
I have text flowing from Frame A into connected Frame B.
I want the text in Frame A to be right aligned, but the text in frame B to be left aligned.
The Variable Text Editor will only allow me to set it statically, but I have variables that could be empty lines - leaving an unsure number of lines flowing into Frame B.
How can I have Frame B force left aligned text?
Alignment change between Connected Text Frames
in FusionPro® VDP Creator
Posted
Unfortunately, FusionPro support was very unhelpful. The support person seemed very uninterested in reading my explanation, this forum thread, or understanding what I was trying to do - but I was able to solve the problem using chatGPT to write javascript alone (instead of using FusionPro connected frames).
I used two javascript rules. One to create a text block using the first 5 non-blank fields, and another to create a textblock using any non-blank fields that did not fit into the first texblock.
I'm sure it's not elegant, but it allowed me to create the illusion of text flow, but separately - so I could format the text as needed per frame.
First Text Block rule
//create a text block containing the first 5 non-blank variables (including some necessary added text before specific fields). var textBlock1 = ""; var fields = [ Field("Street Address"), Field("City State ZIP"), Rule("Direct Format RULE"), Rule("Cell Format RULE"), Rule("Main Format RULE"), Field("Email"), Field("Website"), Field("NMLS") ]; var maxFields = 5; var includedFields = 0; for (var i = 0; i < fields.length; i++) { if (fields[i] !== "") { if (i === 2 && fields[i] !== "") { textBlock1 += "Direct: " + fields[i] + "\r\n"; } else if (i === 3 && fields[i] !== "") { textBlock1 += "Cell: " + fields[i] + "\r\n"; } else if (i === 4 && fields[i] !== "") { textBlock1 += "Main: " + fields[i] + "\r\n"; } else if (i === 7 && fields[i] !== "") { textBlock1 += "NMLS # " + fields[i] + "\r\n"; } else { textBlock1 += fields[i] + "\r\n"; } includedFields++; if (includedFields >= maxFields) { break; } } } return textBlock1;
Second Text Block Rule
//create a text block containing any variables that did not fit into the first text block (including some necessary added text before specific fields). var textBlock1 = ""; var textBlock2 = ""; var fields = [ Field("Street Address"), Field("City State ZIP"), Rule("Direct Format RULE"), Rule("Cell Format RULE"), Rule("Main Format RULE"), Field("Email"), Field("Website"), Field("NMLS") ]; var maxFields = 5; var includedFields = 0; for (var i = 0; i < fields.length; i++) { if (fields[i] !== "") { if (includedFields < maxFields) { if (i === 2) { textBlock1 += "Direct: " + fields[i] + "\r\n"; } else if (i === 3) { textBlock1 += "Cell: " + fields[i] + "\r\n"; } else if (i === 4) { textBlock1 += "Main: " + fields[i] + "\r\n"; } else if (i === 7) { textBlock1 += "NMLS #: " + fields[i] + "\r\n"; } else { textBlock1 += fields[i] + "\r\n"; } } else { if (i === 2) { textBlock2 += "Direct: " + fields[i] + "\r\n"; } else if (i === 3) { textBlock2 += "Cell: " + fields[i] + "\r\n"; } else if (i === 4) { textBlock2 += "Main: " + fields[i] + "\r\n"; } else if (i === 7) { textBlock2 += "NMLS #: " + fields[i] + "\r\n"; } else { textBlock2 += fields[i] + "\r\n"; } } includedFields++; } } return textBlock2;