Jump to content

with a complex disclaimer rule


dleahy

Recommended Posts

Hello all,

 

Having a problem with a quite complex disclaimer rule I have to write. Here is the logic I am trying to achieve and the problem I am facing:

 

A customer chooses from a 3 topics from a dropdown library list of 20 topics in three different drop downs.

 

Dropdown A

-Topic 1

-Topic 2

-Topic 3...

Dropdown B

-Topic 1

-Topic 2

-Topic 3...

Dropdown C

-Topic 1

-Topic 2

-Topic 3...

 

When a topic is selected, it is assigned a disclaimer. The disclaimer is setup as a formatted text resource. In this disclaimer there are embedded rules along with static content that link to other formatted text resources that contain variable parts of the disclaimer. Every different topic could have a different variable line.

 

Say Topic E could have variable line A and G whereas Topic B could have variable line A, E, G, and X.

 

The hard part in writing this rule is the fact that is has to allow for the line of variable text to not appear more than once even though they can select topics that might be assigned to the same variable line.

 

So lets say the user did this scenario:

Filled out all three dropdowns with the following:

Dropdown 1: Topic E = Variable lines A &G

Dropdown 2: Topic J = Variable lines A & F

Dropdown 3: Topic X = Variable lines A & B & F & S

 

I only want Variable line A and F to appear once even though they are selected 3 times and 2 times respectively.

 

Here is the code I thought would work:

My thought process is that I could write a rule for each variable disclaimer copy line and topic...

This code is factoring in that I already went though and picked out all the topics that use a respective variable line of disclaimer copy.

 

Like this example...

Variable Disclaimer Copy 1 is used in the following titles:

• Protecting Purchasing Power (CE)

• Global & Financial Market Outlook

• Globalize Your Thinking (CE)

• Beyond Bonds - Income Alternatives with Growth Potential

• High Conviction Investing: The Benefits of Active Management

• Senior Floating Rate and High Yield Bonds Can Potentially Help Your Investors

• Investing in an Uncertain World

• Globalization: A New Era for Defined Contribution Plans

 

which is why I'll have to write a rule similar to this eight times. Each unique topic will check the other ones to insure they do not equal a topic that already includes that variable line.

then it will return nothing until it finds the one the user entered...

 

if ((Field("SelectInviteTopicOne") == "Protecting Purchasing Power (CE)") || 
   (Field("SelectInviteTopicTwo") == "Protecting Purchasing Power (CE)") || 
   (Field("SelectInviteTopicThree") == "Protecting Purchasing Power (CE)"))
   return Resource("Variable Disclaimer Copy 1");
else if (Field("SelectInviteTopicOne") != "Global & Financial Market Outlook")
           return ""
else if     (Field("SelectInviteTopicTwo") != "Global & Financial Market Outlook")
           return ""
else if     (Field("SelectInviteTopicThree") != "Global & Financial Market Outlook")
           return ""
else if     (Field("SelectInviteTopicOne") != "Globalize Your Thinking (CE)")
           return ""
else if     (Field("SelectInviteTopicTwo") != "Globalize Your Thinking (CE)")
           return ""
else if     (Field("SelectInviteTopicThree") != "Globalize Your Thinking (CE)")
           return ""
else if     (Field("SelectInviteTopicOne") != "Beyond Bonds - Income Alternatives with Growth Potential")
           return ""
else if     (Field("SelectInviteTopicTwo") != "Beyond Bonds - Income Alternatives with Growth Potential")
           return ""
else if     (Field("SelectInviteTopicThree") != "Beyond Bonds - Income Alternatives with Growth Potential")
           return ""
else if     (Field("SelectInviteTopicOne") != "High Conviction Investing: The Benefits of Active Management")
           return ""
else if     (Field("SelectInviteTopicTwo") != "High Conviction Investing: The Benefits of Active Management")
           return ""
else if     (Field("SelectInviteTopicThree") != "High Conviction Investing: The Benefits of Active Management")
           return ""
else if     (Field("SelectInviteTopicOne") != "Senior Floating Rate and High Yield Bonds Can Potentially Help Your Investors")
           return ""
else if     (Field("SelectInviteTopicTwo") != "Senior Floating Rate and High Yield Bonds Can Potentially Help Your Investors")
           return ""
else if     (Field("SelectInviteTopicThree") != "Senior Floating Rate and High Yield Bonds Can Potentially Help Your Investors")
           return ""
else if     (Field("SelectInviteTopicOne") != "Investing in an Uncertain World")
           return ""
else if     (Field("SelectInviteTopicTwo") != "Investing in an Uncertain World")
           return ""
else if     (Field("SelectInviteTopicThree") != "Investing in an Uncertain World")
           return ""
else if     (Field("SelectInviteTopicOne") != "Globalization: A New Era for Defined Contribution Plans")
           return ""
else if     (Field("SelectInviteTopicTwo") != "Globalization: A New Era for Defined Contribution Plans")
           return ""
else if     (Field("SelectInviteTopicThree") != "Globalization: A New Era for Defined Contribution Plans")
           return "";

 

I appreciate any help anyone could forward me. I am taking a javascript class in a couple weeks that I hope will prove useful in working with these types of issues.

I really don't know how to approach this complex a statement.

 

Best,

-Dan

Edited by dleahy
Link to comment
Share on other sites

You said "Topic E = Variable lines A & G" so I presume that means you know each variable line possible.

 

First, I would create a global variable called "DisclaimerText".

 

Secondly, create a resource for each variable disclaimer line that could appear, and name it using a single character to identify it (i.e. "DisclaimerLine_A", "DisclaimerLine_B", etc.)

 

Then, thirdly, put code similar to the following in your OnRecordStart rule:

a = ""
for (x=1; x<4; x++)
 {  switch(x)
      {  case 1: TopicField = "TopicOne";
          case 2: TopicField = "TopicTwo";
          case 3: TopicField = "TopicThree";
       }
     switch (Field(TopicField))
       {
          case "Global & Financial Market Outlook": a += "AE";
          case "Investing in an Uncertain World": a += "AF";
          case "Beyond Bonds - Income Alternatives with Growth Potential": a += "ABFS";
//            ... add as many case statements as needed (one for each topic possible) to show
//                which variable disclaimer lines that each topic gets, each time appending
//                it to the variable "a"
           case "High Conviction Investing: The Benefits of Active Management": a += "DHR";
       }  
 }

// Loop through a, if current character of a isn't found in b, add it to b
b = ""
for (x = 0; x < Len(a); x++)
 {  if(StringToNumber(b.indexOf(a.substr(x,1))) = -1) 
       {  b += a.substr(x,1);
       }
 }

// Now combine all the disclaimer lines from their respective Resources
for (x = 0; x < Len(b); x++)
 {  DisclaimerText += Resource.content("DislaimerLine_" + b.substr(x,1))
 }

Lastly, create a rule that returns the global DisclaimerText variable and place that rule into your text frame:

return DisclaimerText;

That should work, I think! :)

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