Jump to content

If/then statement troubles


Recommended Posts

I will prefix this by saying that I am new to FusionPro and am stumbling my way through learning javascript. I am struggling to create what I thought would be an easy rule. I need to create a rule that changes a line of text based on how many years a member has been a member. Below, I pasted my last of many tries. Any ideas?

 

Thanks,

Jeff

 

--------------------------------------------

 

//change membership card line that reades "Member for..."

 

var y=Field("Years Of Membership")

 

if (Field("Years Of Membership")> "1")

{

document.write("Member for ".y );document.write(" Years")

}

 

if (Field("Years Of Membership")== "0")

{

document.write(" ")

}

 

if (Field("Years Of Membership")== "1")

{

document.write("Member for ".y );document.write(" Year")

}

 

 

-----------------------------------------------------------

Link to comment
Share on other sites

Jeff,

 

Are you trying to code this in FusionPro? It looks like you are trying web javascript commands here which are a bit different. Try this...

var y= Int(Field("Years Of Membership"));
if (y == 0)  {
    return "";
}
else if (y == 1)  {
    return "Member for " + y + " Year."
}
else if (y > 1)  {
    return "Member for " + y + " Years."
}

Hope this helps you on your way.

Good Luck.

.

Link to comment
Share on other sites

That worked great! Thank you so much for you help.

 

I was trying to code it in FusionPro but used some javascript code that I found online. I'm used to creating variable code in PrintShop Mail so this is an adjustment. I'm sure I'll get the hang of it in time.

 

Thanks again

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...