Jump to content

Tab issues within empty variable lines


Kal

Recommended Posts

I have 6 lines of variables and all are being tabbed and then the variable.

When one of the line is empty it won't suppress that line, it's still seeing the tab.

How do I get around this?

 

Example:

Static Header:TAB..Variable Line1

TAB......................Variable Line2

TAB......................

TAB......................Variable Line4

TAB......................

TAB......................Variable Line6

Link to comment
Share on other sites

Can I get an example of a JavaScript rule with Tabs and skip empty lines?

Maybe using my example in the Script?

Does switching to "Suppress if Containing Empty Variables" not work for you?

 

Anyway, your example doesn't say what your actual variable field names are, but you could do something like this:

var result = [];
for (var i = 1; i <= 6, i++)
{
   var line = Field("SomeNameHere" + i)
   if (line)
       result.push("<t>" + line);
}
return result.join("<br>\n");

Link to comment
Share on other sites

Dan I made a test file for you.

Let me know what I'm doing wrong.

Thanks.

What you're doing wrong is that you haven't actually set those lines to "Suppress if Containing Empty Variables." They're all still set to "Suppress if Empty."

 

Remember that the settings in the Paragraph Formatting dialog affect only the currently selected paragraph(s), so if you just have the cursor set somewhere randomly in the text frame and open the Paragraph Formatting, whatever you change in there is not going to affect the entirety of the text, unless you have all the text selected.

 

So I think the easiest way to do what you want is to open up the text frame, select all the text (with Ctrl-A), then click the Paragraph button, change the setting in the "Suppress if" drop-down list to "Containing Empty Variables," then click OK, and OK again. That's what I did, and now the other paragraph "floats up."

 

Also, you have multiple borrowers' names straddling different lines. You probably want to keep each borrower's first and last named together on the same line, separate from other borrowers' names, like so in the Text Editor:

 

Borrower(s): «PD_BORROWER1_NAME1» «PD_BORROWER1_NAME2»

«PD_BORROWER2_NAME1» «PD_BORROWER2_NAME2»

«PD_BORROWER3_NAME1» «PD_BORROWER3_NAME2»

«PD_BORROWER4_NAME1» «PD_BORROWER4_NAME2»

«PD_BORROWER5_NAME1» «PD_BORROWER5_NAME2»

«PD_BORROWER6_NAME1» «PD_BORROWER6_NAME2»

«PD_BORROWER7_NAME1» «PD_BORROWER7_NAME2»

«PD_BORROWER8_NAME1» «PD_BORROWER8_NAME2»

«PD_BORROWER9_NAME1» «PD_BORROWER9_NAME2»

 

This can all also be done easily enough in JavaScript, like so:

var result = [];
for (var i = 1; i <= 6; i++)
{
   var line = Field("PD_BORROWER" + i + "_NAME1") + " " + Field("PD_BORROWER" + i + "_NAME2");
   if (Trim(line))
       result.push("<t>" + line);
}
return result.join("<br>\n");

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