?
Solved

For every datawindow retrieved, is it possible to show negative values of all numeric columns in red colour.

Posted on 2004-11-21
12
Medium Priority
?
578 Views
Last Modified: 2013-12-26
For every datawindow retrieved, is it possible to show negative values of all numeric columns in red colour.
0
Comment
Question by:Mateen
  • 4
  • 4
  • 2
  • +2
12 Comments
 
LVL 10

Expert Comment

by:Sys_Prog
ID: 12641619
Hi Mateen,
Write an expression at runtime

Cheers!
0
 
LVL 10

Expert Comment

by:Sys_Prog
ID: 12641630
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
 
LVL 33

Expert Comment

by:sajuks
ID: 12641738
A simpler way would be to directly paste this in the format of the field
#,###;-[RED]#,###
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 10

Expert Comment

by:Sys_Prog
ID: 12641770
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
 
LVL 33

Expert Comment

by:sajuks
ID: 12641772
This is what we normally use
 #,###;[RED](#,###);0
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12641798
Am just giving another solution. I nev'r said yours is wrong.
0
 

Author Comment

by:Mateen
ID: 12642060
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
 
LVL 8

Expert Comment

by:gajender_99
ID: 12642702
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
 
LVL 33

Expert Comment

by:sajuks
ID: 12642820
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
 
LVL 4

Assisted Solution

by:Bhatti
Bhatti earned 800 total points
ID: 12643557
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
 
LVL 8

Accepted Solution

by:
gajender_99 earned 1200 total points
ID: 12643591
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
 
LVL 10

Expert Comment

by:Sys_Prog
ID: 12651780
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month14 days, 4 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question