Jump to content

Recommended Posts

Posted

Hi there,

I'm getting weird results and I'm not sure where my code is wrong.

I have 4 pages all set to unused.

Local records are page 1 & 2

Out of state are 3 & 4

so I'm using this OnRecordStart rule

but I'll get something like record 1 = pg 1,3,4.

 

if (Field("List")=="Local")
{
FusionPro.Composition.SetBodyPageUsage("1", true)
FusionPro.Composition.SetBodyPageUsage("2", true)
FusionPro.Composition.SetBodyPageUsage("3", false)
FusionPro.Composition.SetBodyPageUsage("4", false)
} 
if (Field("List")=="Out of State")
FusionPro.Composition.SetBodyPageUsage("1", false)
FusionPro.Composition.SetBodyPageUsage("2", false)
FusionPro.Composition.SetBodyPageUsage("3", true)
FusionPro.Composition.SetBodyPageUsage("4", true)
}

I tried to look at the code Dan wrote for page ranges, but I can't wrap my head around the var i <= 6 i++ stuff. o.O

Anyone know what I'm doing wrong here?

 

Cheers,

Mike

Posted

Are your pages named 1, 2, 3, and 4? If not you may need to make the page numbers integers instead of strings:

if (Field("List")=="Local")
{
FusionPro.Composition.SetBodyPageUsage(1, true)
FusionPro.Composition.SetBodyPageUsage(2, true)
FusionPro.Composition.SetBodyPageUsage(3, false)
FusionPro.Composition.SetBodyPageUsage(4, false)
} 
if (Field("List")=="Out of State")
FusionPro.Composition.SetBodyPageUsage(1, false)
FusionPro.Composition.SetBodyPageUsage(2, false)
FusionPro.Composition.SetBodyPageUsage(3, true)
FusionPro.Composition.SetBodyPageUsage(4, true)
}

Or:

var page = Field("List") == "Local" ? 1 : 3;
FusionPro.Composition.SetBodyPageUsage(page, true);
FusionPro.Composition.SetBodyPageUsage(page + 1, true);

Posted

Yes the pages are just named 1 2 3 and 4 respectively.

ok so putting the "" changes the meaning! I see.

thanks Step

 

What does this mean after the local:

? 1 : 3;

Posted

OK, and then the page and page + 1 just grabs the next page after 1 and 3 respectively?

 

That code worked great. I didn't have success just removing the "" 's though.

 

Thanks Step for explaining it too!

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