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.
MateenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sys_ProgCommented:
Hi Mateen,
Write an expression at runtime

Cheers!
0
Sys_ProgCommented:
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

0
sajuksCommented:
A simpler way would be to directly paste this in the format of the field
#,###;-[RED]#,###
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Sys_ProgCommented:
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
0
sajuksCommented:
This is what we normally use
 #,###;[RED](#,###);0
0
sajuksCommented:
Am just giving another solution. I nev'r said yours is wrong.
0
MateenAuthor Commented:
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.
0
gajender_99Commented:
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.Column.Count

for i= 1 to ls_count
//set the current column
dw_1.setcolumn(i)

//get the column name
ls_colname=dw_1.GetColumnName()
ls_number=string(dw_1.Object.Data[1,i])
if isnumber(ls_number) then
   dw_1.Modify( ls_colname+".Color='0~tIf("+ls_colname+"< 0,255,65280)'")
End if
Next


i think this should work

if you have any error message just let us know
0
sajuksCommented:
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
0
BhattiCommented:
Hi,

There are two ways:

1. In Every DW in the columns where you want to show the red color values, write the following in the property tab of the column in the text color property:

if(column_name < 0, RGB(0,255,0), RGB(0,0,0))

2. develop a Function() as f_SetNegValuesRed(dw)

f_SetNegValuesRed(dw_1)

Integer li_column, li_count
String   ls_coltype, ls_col, ls_columncount, ls_colname

ls_columncount = dw_1.Describe(datawindow.coumn.count")
li_column = Integer(ls_columncount)
//Now you have total column
FOR li_count = 1 TO li_column
   ls_colname = dw_1.Describe("#"+string(li_count)+".Name")
   ls_coltype = dw_1.Describe(""+ls_colname+".ColType")
   CHOOSE CASE ls_coltype
      CASE 'long','integer', etc
          dw_1.Modify(""+ls_colname+".TextColor='0' ~t if(ls_colname < 0, 255,0))
   END CHOOSE
NEXT

Please correct the syntax error yourself:

Write this function in every window where you have such dw having values to show black or red.

You need to develop this function and call it everywhere you need.

If you need any further explanation, please let me know

Best regards

Bhatti
0
gajender_99Commented:
hi mateen

second way could be but accurate you column should have tab order greater than zero if yes then try this

long ls_count,i
string ls_number,ls_colname
ls_count = dw_1.Object.DataWindow.Column.Count

for i= 1 to ls_count
//set the current column
dw_1.setcolumn(i)

//get the column name
ls_number=dw_1.Describe(This.GetColumnName()+".ColType")
if upper(ls_number)="NUMBER" then
   dw_1.Modify( this.getcolumnname()+".Color='0~tIf("+ls_colname+"< 0,255,65280)'")
End if
Next
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sys_ProgCommented:
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.