Help with XMPie rule

Started by DCurry, January 19, 2024, 04:57:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DCurry

Still pretty new to XMPie, but for the most part I'm feeling comfortable with it. Ran into an issue today trying to write a fairly simple rule and I'm sure I'm doing something wrong but can't figure it out.

In my data I have a field that contains numbers. Sometimes the field is empty, sometimes it contains a zero, and all the rest of the time it contains a number. The rule I want to write (in layman's terms) is: 

If (field) is empty or "0", then return nothing.
Else return (field) and some other text.

When I try to write the rule, XMPie complains that I'm mixing numbers and strings. I don't really care that it's a number because I'm not trying to do any math to it.

(I don't have exact verbiage because I'm not at work.) Any thoughts on what I need to do to make this work?
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!

Joe

It has been a couple of years so forgive me if this is dumb....

If the field is a number field would "0" make it think that is a string. Can you to make it:

If (field) is empty or =0, then return nothing.
Else return (field) and some other text.
Mac OS Sonoma 14.2.1 (c) | (retired)

The seven ages of man: spills, drills, thrills, bills, ills, pills and wills.

pspdfppdfxhd

Thats how she rolls Joe, basic, but the general concept!

DCurry

Joe, I believe that's how I attempted to build the rule. Will take a screenshot on Monday to confirm.
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

Came at it this morning with fresh eyes and I think I've got it - I was using "+" when I should have been using "&" to concat between a number field and a string of text. I guess the "+" invokes math when it's a number and you can't use math on text.
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!