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;