Page 1 of 1

Calculation query...

PostPosted: Tue Aug 02, 2005 9:55 am
by Moonunit
Hiya all,
I'm hoping that I'm just having a momentary blip and that the following query is phenomenally easy to resolve...

In a single record, same table...I'm trying to combine a math calculation (number) with a text alternative, and it's not working! Well it is, but I've lost all the number formatting in achieving it...

I've based the calc on the If function, so...

If ( text field > 0 ; "Text-message"; calc field)
Or putting it another way...
If ( "Trouble"; "TBC"; "$ 20.00")

The 'text field' is based on another (text) calculation and the calc field is a nested numbers calculation.

Is it possible to combine both numbers and text within a calculation?

Tim

PostPosted: Tue Aug 02, 2005 11:24 am
by John Sindelar
You can certainly have both numbers and text in the same calculation, but the calc can only return a value of one "type". At the end of the day you're going to want your calc to return text.

If the results of the calc will be used in other math operations, then you'll want two separate fields: one with a numeric result and one with a text result.

If the result won't be used in other math operations- and you still want just one field- you'll want a text result and you can't apply number formatting to the text using the Field Format options. You'll have to apply your dollar formatting with something like this custom function.

Since it looks like you already have the calc field, what about just formatting that not to show if 0 and creating a second field for just the text alternative?