Number display in text display object


#1

This has to be dead easy but I’m not getting it. What is the easiest way to get the total of a floating point field to display as dollars and cents in a text display object?

I have #.,## selected under output pattern under field properties in the sheet, and it displays correctly in the sheet.

For the TDO I have the field name in the Formula. I tried to apply a pattern to the formula but no luck.

When I run my procedures that create the total, sometimes it displays correctly and sometimes throws in 3-5 extra decimal places. Seems random.

I also found some notes from Jim on changing the blueprint but my one small attempt to tinker with that was rejected. A little knowledge etc. etc.

Thanks,
bk


#2

You should be able to use

pattern(total,"#.,##")

as your formula. The pattern( function would be part of the formula, not something that is applied to it.


#3

I’m still at sea. If I put this: pattern(total,"#.,##") in the Formula box for the TDO, the TDO displays the word “Expression”

For what it’s worth, this small procedure is generating the total:

selectall

removeallsummaries

Call “SelectOrderItems”

field «QO_Extended»

total

field «QO_Extended»

lastrecord

b.


#4

That’s probably part of a larger error message. If your field isn’t named total, you should change that to whatever it is named. Otherwise, you could enlarge the object so that you can see the rest of the error message.


#5

If it is any help, here is a screen shot of a quick example Text Display Object I put together.

image


#6

Who knew an error message was hiding in the little box?

So this works: pattern(QO_Extended,"#.,##")

and this adds a dollar sign:

pattern(QO_Extended,"|||$|||+#.,##")

Rescued, again–Thanks Dave!

b


#7

pattern(QO_Extended,"$#.,##") – this gives me an expression parsing error. Looks identical in format to Gary’s formula so I don’t know why it doesn’t work. If I remove the $ sign it works fine.

b


#8

Nor do I. I just changed the name of the field to match yours and copy/pasted the formula above to the TDO and it worked as expected - no error.
image


#9

Got it. For no good reason–since I don’t know what it does–under the TDO options I accidentally had selected the mode “Evaluate Formula Twice”. Changing it back to “Formula” solves the $ problem.

PIcky picky software.

Thanks
bk


#10

It evaluates the formula once, and then interprets the resulting text as a formula, and then evaluates that formula. The final result is the result of the generated formula. I don’t think this feature was used very often, but Panoramas 3 through 6 had it, and there are bound to be users who do use it.


#11

I think it was very rarely used. The reason it was originally put in was to provide a way to get around the 255 character limit for a Text Display formula. You could put a formula of any length into a variable, specify that variable as the formula, then use the “evaluate twice” option. The result would be the value of the formula that had been put in the variable.

In Panorama X Text Displays formulas can be any length, there is no longer a 255 character limit, so there is no need for this option. However, it is included in case someone brought over a Panorama 6 database that used the option, so that it would work out of the box. (I know some of you think that little or no effort was put into maintaining Panorama 6 compatibility in Panorama X, but actually a huge amount of effort was put into this, probably at least a year out of the 6 year project, maybe even 2 years. It would have been significantly easier/faster to create Panorama X if Panorama 6 compatibility wasn’t an issue.)


#12

And that’s very much appreciated by the vast majority of Panorama X users.