Jump to content

Suppressing content when the content is placed in a table


Cat

Recommended Posts

Hello,

I'm trying to place content in a table because I need to have 3 columns of information: first column: store #, second: job title, and third: years worked. The text frame has the information set to suppress if containing an empty variable, but once the frame is placed in the table, then the static content shows, even when there is no variable. Where do I look to turn on the suppress if containing an empty variable in the table?

I've attached the template.

Please help me with a solution that will work the way my client needs this item to work. Thank you.

ID70CareerPyr_final.txt ID70_RPIS0819R_5x7_CareerPyramidSign.pdf

Link to comment
Share on other sites

Thomas,

I see you made the text frame wider, I thought that was cheating ;) Thank you, I think that will work.

It looks like I will need to put some character limits on the fields so that the information will not crash into each other if the job name is long.

Link to comment
Share on other sites

If you add the following code to an OnRecordStart rule, it will copyfit the pos#Dept fields to fit the 2 inch space. Then you don't need to limit the characters.

for (i = 1; i <= 6; i++)
{
    var fn = "pos" + i + "Dept"
    if (Field(fn)) {
        var cf = CopyfitLineWithMagnify(Field(fn), "Brandon Grotesque Regular", 14, 140, false, "textwidth");
        FusionPro.Composition.AddVariable(fn, '<span>' + cf + '</span>', true);
    }
}

 

  • Thanks 1
Link to comment
Share on other sites

Thomas,

I used your pretty code but there's a little issue.

For some reason the following line seems to "think" it has a value, so it's showing the static elements even when there is no value in the variable. (see attached screen capture)

Screenshot 2023-08-21 at 12.57.25 PM.png

Link to comment
Share on other sites

I'm not sure where that would be coming from unless MarcomCentral is sending some tags along with the text. They way you have it formatted, it would have to be sending something for every single field. If even one on the line is blank the entire line would be omitted. The copyfitting code only effects the pos#Dept fields which isn't enough to change the result if say the pos#StoreNo field was blank, the whole line should omit.

You could try changing the code in OnRecordStart:

change:
if (Field(fn)) {
to:
if (RawTextFromTagged(Field(fn)).length > 10) {

This makes sure its only evaluating non-markup text and if the length is greater than 10, which it would need to be if it needed to be copyfit.

I don't suspect this will make any difference though, as I said, if one of the other fields is blank the whole line should not show.

The other thing you could do, which is a much more aggressive method, is to strip any tags from all the empty field inputs. Add this code above the other code in OnRecordStart:

for (var f in FusionPro.Fields)
{
    if (!Trim(RawTextFromTagged(FusionPro.Fields[f])))
        FusionPro.Composition.AddVariable(f, "", false);
}

Not sure if any of this will work but it's worth a shot.

Link to comment
Share on other sites

Thomas,

Nope. Sigh.

In an attempt to see if values were passing, I looked at the settings in the forms and there were no values set to pass from any of the fields. So I believe that has been ruled out. If that were the case, then all the static values would pass and not just the one after the field entered.

One of the reasons to use the table options was to force padding, but, as was seen, the static information does not want to be suppressed.

One curious note: When I open the "OnRecordStart" rule I created from the code you provided, the FusionPro Composition System dialog window pops up and appears to process. I've not ever seen that happen when I've worked with the "OnRecordStart" rule before, limited though my xp is.

Here is the log

Job started 06:28:26 - 1692710906.
Creator: FusionPro(R) VDP Creator 13.0.2
Computer Name: 
Current working folder: /Applications/PTI/FusionPro
Temporary files folder: /var/folders/b3/3ys0r7dn6338kvb7_5d_rf280000gr/T/
Template File: /Volumes/ASSETS_FONTS_TEMPLATES/online_templates/nordstrom rack (pti - 24261 to dr - nordstromrack)/id_70 - rpis0819r_5x7_career pyramid sign/Fusion_Templates_FINAL/ID70_RPIS0819R_5x7_CareerPyramidSign.dif
Input File: /Volumes/ASSETS_FONTS_TEMPLATES/online_templates/nordstrom rack (pti - 24261 to dr - nordstromrack)/id_70 - rpis0819r_5x7_career pyramid sign/Fusion_Templates_FINAL/ID70CareerPyr_final.txt
Job Config File: /private/var/folders/b3/3ys0r7dn6338kvb7_5d_rf280000gr/T/ID70CareerPyr_final-Output.cfg
Composing record #1, input record 1
Composing record #2, input record 2
Composing record #3, input record 3
Composing record #4, input record 4
Graphic is not found or is not processed properly: IMG_0174.jpg.
Check for file existence and that it is of the proper format.
Composing record #5, input record 5
Graphic is not found or is not processed properly: IMG_0174.jpg.
Check for file existence and that it is of the proper format.
Composing record #6, input record 6
Composing record #7, input record 7
Job ended 06:28:27 - 1692710907.
Total Job Time: 1s

 

Here is the "OnRecordStart" Rule that is in the file:

for (var f in FusionPro.Fields)
{
    if (!Trim(RawTextFromTagged(FusionPro.Fields[f])))
        FusionPro.Composition.AddVariable(f, "", false);
}

for (i = 1; i <= 6; i++)
{
    var fn = "pos" + i + "Dept"
    if (RawTextFromTagged(Field(fn)).length > 10) {
        var cf = CopyfitLineWithMagnify(Field(fn), "Brandon Grotesque Regular", 14, 140, false, "textwidth");
        FusionPro.Composition.AddVariable(fn, '<span>' + cf + '</span>', true);
    }
}

 

I appreciate your help!

Link to comment
Share on other sites

Thomas,

There was a bad setting in the the text frame! Line #4 was set to "Suppress if Empty" and NOT "Suppress if Containing Empty Variable" once I got that fixed, the code worked. 

I tested the issue by adding numbers to each line to see the exact information that was passing to the item, once I was able to ID the specific line that was misbehaving, that last issue was fixable.

I've not had time to go through the Rules Manual and am in the process of trying to learn JavaScript, and there are days when my brain don't wanna! 

Thank you so damn much for your help!!

Link to comment
Share on other sites

I'm glad you got it worked out. You can simulate the padding with the copyfitting by reducing the width. I had it set to 140 points which is just under 2 inches. If you want to ensure an eighth inch on either side then reduce to 126 or whatever works for you.

One thing that helped me when I started learning FusionPro was printing out the Javascript section of the rules guide, put it in a binder, and just write notes all over it. I also started collecting snippets of code in text files and named them in ways that would help me search them later. I still refer to them every so often even 10 years later.

  • Thanks 1
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...