numeric data in grid cells: how to round?

Started by PMM_CAI, May 06, 2024, 05:22:23 PM

Previous topic - Next topic

PMM_CAI

Using PxP 2022. My question concerns formatting of data in numeric cells in a grid. In Format Definition, I assign a numeric variable name to my column; e.g. Cost. In my supporting program, I set the cost's format mask with

let detail_box.ctl'Column$="Cost",detail_box.ctl'row=0, detail_box.ctl'cellformat$="######0.00-"

In the PxP documentation, the CellFormat property redirects to the documentation about multi-line Fmt$ property, which says "Before being output, the number is rounded to the number of decimal places specified in the format mask." But when I test, it truncates, not rounds. (By the way, the incoming value does not exceed the mask.)

Is there a correct way of having numeric grid cell data round instead of truncate?

Thanks in advance.

Paula McKeever
CAI Software LLC

PMM_CAI

I neglected to mention that I cannot convert the data to string prior to loading the grid. It needs to be numeric so that it gets exported as numeric data to a spreadsheet.

James Zukowski

Not sure if this would apply... Have you checked out the 'RI' and 'RN' parameters?
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

PMM_CAI

Thanks James. 'RI' did the trick, although we haven't decided about using it yet, since we don't want the behavior to be used elsewhere, and we might not want to risk turning it on in the pgm and then aborting out before turning it back off. But we are considering it! Thanks again.

Paula McKeever
CAI Software LLC

James Zukowski

As a possibility, you could enable it before the load and disable it immediately after. That would minimize the potential crash time.
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services