The field is set up as follows:

D PCT_OF_TOTAL S 6 2 INZ(0)

The field is calculated as follows:

PCT_OF_TOTAL = (LBPOUNDS / DIVISION_TOTAL);

It is placed on the sheet as follows:

hssf_num ( row: 3 : PCT_OF_TOTAL : Percents);


Are you saying that I should use a data type other than decimal?

Hmmm... not saying that at all. I usually do this as a formula, so
that if someone modifies one of the cells on which the percentage is
based, all will adjust... and that looks like this:

hssf_formula(row: colnbr: hssf_cellName(RN:colnbr-1) + '/'
+ hssf_cellName(RN:colnbr-2): pctCell) ;

I don't see anything you are doing wrong, though. When I finish my
workday, I'll try to throw together a sample using your code, and see
what I can come up with. Best I can offer at present.

The program at http://www.lovelady.com/misc will, with the right headers and
service program, produce the output you desire. I don't see anything wrong
with your program, but then again I don't see your entire program.

Is it possible for you to put your program into debug mode, break at
hssf_num's first line and to see what's in your percentage variable (the
value RECEIVED by HSSF_NUM procedure; not the external one that's passed
in... in the sample below, it would be "Number")? I'm thinking the problem
you cite actually is prior to calling hssf_num... or perhaps hssf_num is not
defined correctly? Here's mine:

P hssf_num B Export
D hssf_num PI
D Row like(HSSFRow)
D Col 5I 0 value
D Number 8F value
D Style like(HSSFCellStyle)

D Cell S like(HSSFCell)

/free
Cell = HSSFRow_createCell(Row: Col) ;
HSSFCell_setCellType(Cell: CELL_TYPE_NUMERIC) ;
HSSFCell_setCellValueD(Cell: Number) ;
HSSFCell_setCellStyle(Cell: Style) ;
hssf_freeLocalRef(Cell) ;
/end-free
P hssf_num E


Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"Nature gave man two ends - one to sit on and one to think with. Ever since
then man's success or failure has been dependent on the one he used most."
-- George R. Kirkpatrick



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.