FusionPro Rule to Remove Comma

Started by Slappy, March 28, 2025, 11:01:03 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Slappy

Feel like should be one of the simplest Rules, and yet...here I am.

I've got a single line, with 2 fields, where if the 2nd field isn't populated, the "hard" comma separating them should drop out. Code as it stands:

if (Field("Company") > 1)
{
return ",";
}
else
{
return " ";
}

"Company" being the first field in the line. "Addressee" is the first field and always populates.
But, it never inserts the comma when needed. It's placed in the Text block as attached.
Are I dum?
A little diddie 'bout black 'n cyan...two reflective colors doin' the best they can.

Slappy

To get it out the door, I did a CONCAT field in Excel for now, but this really shouldn't be a problem.
Stupid Friday brain.
A little diddie 'bout black 'n cyan...two reflective colors doin' the best they can.

DigiCorn

I wish I still had FusionPro. I remember writing this exact script over 12 years ago, but now (with all the alcohol) my memory fails me.
People say you look like M.C. Hammer on crack

DCurry

Might be that you need to say if the LENGTH of the company field is greater than or equal to 1. Not up on my JavaScript. 

Maybe instead try saying if the field Company is not "" then return ","
Prinect • Signa Station • XMPie

Build a man a fire, and he'll be warm for a night. But set a man on fire, and he'll be warm for the rest of his life!

DCurry

Also looks like if you do get it to work you'll have a space before the comma. 
Prinect • Signa Station • XMPie

Build a man a fire, and he'll be warm for a night. But set a man on fire, and he'll be warm for the rest of his life!

DCurry

One other thing - I would try building the rule using the wizard, or whatever it's called that lets you build it using drop downs. 
Prinect • Signa Station • XMPie

Build a man a fire, and he'll be warm for a night. But set a man on fire, and he'll be warm for the rest of his life!

DCurry

I don't miss FusionPro at all. Lots of easier options out there but it is pretty powerful for the money. Just hard to work with. I remember trying to get it to load fonts was a nightmare.

Currently enjoying XMPie now that I understand how it thinks.
Prinect • Signa Station • XMPie

Build a man a fire, and he'll be warm for a night. But set a man on fire, and he'll be warm for the rest of his life!

Slappy

Took the day off, so I'll probably have a chance to mess with it tomorrow some-thanks for the ideas!

And I'd potentially try to move away from FP, except I'm not the only one using it & wouldn't want to be the only person able to handle VDP jobs if we did cross to say XMPie. It's not horrible, like ya said-just learning its' foibles.
A little diddie 'bout black 'n cyan...two reflective colors doin' the best they can.

DCurry

Prinect • Signa Station • XMPie

Build a man a fire, and he'll be warm for a night. But set a man on fire, and he'll be warm for the rest of his life!

Slappy

Quote from: DCurry on March 31, 2025, 12:04:43 PMA day off already?
Yeah, I'm special - what can I say?
Was our 24th Anniversary, thought it'd be a good idea to appease the Spouse.  ;D
A little diddie 'bout black 'n cyan...two reflective colors doin' the best they can.

Slappy

Ok, THIS worked! I had to find a similar post in the FP Forum and modify theirs, I was getting nowhere using even the Wizard thingy.

if (Len(Trim(Field("Company"))) > 1)
{
return ",";
}
else
{
return "";
}
A little diddie 'bout black 'n cyan...two reflective colors doin' the best they can.

DCurry

Yup, that's looking at the length of the field. Nice!
Prinect • Signa Station • XMPie

Build a man a fire, and he'll be warm for a night. But set a man on fire, and he'll be warm for the rest of his life!