Mateen
asked on
For every datawindow retrieved, is it possible to show negative values of all numeric columns in red colour.
For every datawindow retrieved, is it possible to show negative values of all numeric columns in red colour.
Mateen,
If u have to make it generic,
Then let all your datawindows be inherited from your customized datawindow
Let the customized datawindow (in one of its initialization events) run a loop over all the columns and for all numeric columns, write an expression such that if value < 0, the color = RED
If u have to make it generic,
Then let all your datawindows be inherited from your customized datawindow
Let the customized datawindow (in one of its initialization events) run a loop over all the columns and for all numeric columns, write an expression such that if value < 0, the color = RED
A simpler way would be to directly paste this in the format of the field
#,###;-[RED]#,###
#,###;-[RED]#,###
But in that case, all your data window objects would have to be modified
In the solution I suggested, there would just be a couple of lines addition to the ancestor object and all is done
Amit
In the solution I suggested, there would just be a couple of lines addition to the ancestor object and all is done
Amit
This is what we normally use
#,###;[RED](#,###);0
#,###;[RED](#,###);0
Am just giving another solution. I nev'r said yours is wrong.
ASKER
Hi Sysprog:
Let the customized datawindow (in one of its initialization events) run a loop over all the columns and for all numeric columns
my ancestor datawindow is dw_1
now,
Exact name of the event.
Ho to loop fo find numeric column names.
When numeric column found, how to pass modify statement to set red colour.
What I mean is that I have got the idea but am unable to script it.
Let the customized datawindow (in one of its initialization events) run a loop over all the columns and for all numeric columns
my ancestor datawindow is dw_1
now,
Exact name of the event.
Ho to loop fo find numeric column names.
When numeric column found, how to pass modify statement to set red colour.
What I mean is that I have got the idea but am unable to script it.
Hi mateen just a hint
creat your own event and call it after you have retrived the data using the retrieve command
script for that event
long ls_count,i
string ls_number,ls_colname
ls_count = dw_1.Object.DataWindow.Col umn.Count
for i= 1 to ls_count
//set the current column
dw_1.setcolumn(i)
//get the column name
ls_colname=dw_1.GetColumnN ame()
ls_number=string(dw_1.Obje ct.Data[1, i])
if isnumber(ls_number) then
dw_1.Modify( ls_colname+".Color='0~tIf( "+ls_colna me+"< 0,255,65280)'")
End if
Next
i think this should work
if you have any error message just let us know
creat your own event and call it after you have retrived the data using the retrieve command
script for that event
long ls_count,i
string ls_number,ls_colname
ls_count = dw_1.Object.DataWindow.Col
for i= 1 to ls_count
//set the current column
dw_1.setcolumn(i)
//get the column name
ls_colname=dw_1.GetColumnN
ls_number=string(dw_1.Obje
if isnumber(ls_number) then
dw_1.Modify( ls_colname+".Color='0~tIf(
End if
Next
i think this should work
if you have any error message just let us know
Just a side-note, If there are too many records then during retireval you might've a performance
problem. So od take that also into consideration when writing your code
problem. So od take that also into consideration when writing your code
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
As per the question, for every datawindow, the color of numeric data < 0 should be red
So, my solution was probably the most generic one
Amit
So, my solution was probably the most generic one
Amit
Write an expression at runtime
Cheers!