Datawindow Expressions


I have an expression to change the color of text on row in a datawindow , 
'if (change_colour =1,rgb(255,0,0),rgb(0,0,0) )', but what I am trying to 
do is only change the color of a particular column on the row.

Is there any way to do this? All the columns have to have the expression 
but any combination of the columns are to have the color change.

Hope that makes sense.

1/22/2003 12:03:25 PM
sybase.powerbuilder.general 62418 articles. 19 followers. Follow

8 Replies

Similar Articles

[PageSpeed] 13
Get it on Google Play
Get it on Apple App Store

If I understand the question correctly, you can put the expresion in the 
datawindow.  Go to teh datawindow painter and click on a field (column) you 
want to have use the expression.  (PB8) Click on the FONT tab adn click on 
teh small box to the right of background color (or text color).  Add 
tehexpression there. Note that "change_colour" must be a column in the 
datawindow for this to work.  If change_colour  is not a column and apears 
just in you script, add a column to the datawindow, call it change_colour 
and set it to the value contained in your script.  Adding the column varies 
with how you created the SQL for the datawindow.  You can usually do 
something like adding a line in the select statement like "0 as 
change_colour" to create a column for use row by row on the datawindow 
without having a column on the database.

Let me know if this helps.

- Joe Slawsky ( 
Home of PB Link - The FREE PowerBuilder to Palm Interface
1/22/2003 1:46:25 PM
What you describe is what I have already. The problem is that the whole row 
changes color and not a particular column.

Here is some more background: When the window displays, the user can select 
a column on a row and press Alt+Ctrl+C, this opens a window where comments 
can be entered. When the comments window is closed the only way to tell if 
the column has comments behind it is to change the text color.

If, for example, the row has 4 columns and the user picks col 1 and 4 to 
put comments behind, then those should be the only columns to turn red. But 
because the expression is behind all the columns then when the 
'change_colour' field is set to 1 they all change color to red. Does that 
clarify it a little.

thanks for your help
1/22/2003 2:04:22 PM

Use that same expression in the background property of the column.


On Wed, 22 Jan 2003 07:03:25 -0500,
 in powersoft.public.powerbuilder.general
 <Ron> wrote: 
>I have an expression to change the color of text on row in a datawindow , 
>'if (change_colour =1,rgb(255,0,0),rgb(0,0,0) )', but what I am trying to 
>do is only change the color of a particular column on the row.
>Is there any way to do this? All the columns have to have the expression 
>but any combination of the columns are to have the color change.
>Hope that makes sense.
1/22/2003 2:13:49 PM
I don't quite undestand what you mean here. I only want the text to change 
color not the background.

1/22/2003 2:42:26 PM
Yes it does, I think.  Question 1 is are the comments held in columns on 
the same datawindow as columns 1-4?  If so you can set teh color by the 
length of the comment field on the row as in :

if (Len(comment1) > 0 1,rgb(255,0,0),rgb(0,0,0) )

If the comments are not held on the same datawindow, add duplicate columns 
for columns 1-4 called change_colour1 - change_colour4 and set them as in 
the last email.  That gives you row/column level control.

- Joe Slawsky ( 
Home of PB Link - The FREE PowerBuilder to Palm Interface
1/22/2003 2:57:50 PM
Thanks Joe, worked like a dream (I had to create a separate 'change_colour' 
col for each column on dw).

1/22/2003 3:34:43 PM
You only need one color column.  Your example has this expression:

'if (change_colour =1,rgb(255,0,0),rgb(0,0,0) )'

Make change_color a string and put the color switch for all columns in the 
string.  For instance if you want columns 1 and 3 to be red do the 

change_color = '1010'

In column 1 put this in the text.color expression

"if (mid(change_colour,1)='1',rgb(255,0,0),rgb(0,0,0) )"

In column 2 put this in the text.color expression

"if (mid(change_colour,2)='1',rgb(255,0,0),rgb(0,0,0) )"....

You dont need a change_colour coloumn for every data column.
1/22/2003 7:39:35 PM
This is a great solution, many thanks.
1/23/2003 1:50:36 PM

Similar Artilces:

Modify Expression Editor
How about improving on the Modify Expression Editor a bit? We have some quite complicated expressions, and the tiny little MLE control that PB uses to allow us to edit expression is very clumsy (and yes, I do realize about the elipse to bring up the modal Modify Expression window - which contains an only slight less tiny MLE for editing the Expression). Not to mention that embedded Returns in the expression can cause the computed field to behave funny. How about a real editor, complete with color markups, support for indentation and carrage returns, AutoScript even! Oooh,...

DataWindows Expressions for contraints on grid datawindows...
This may seem like an unholy thing to do to a datawindow, but I ran into a place where it was appropriate. First, I decided that I wanted to use Don Roof's dropdownfilter service for datawindows, which is triggered by clicking on a small bitmap icon which is supposed to be positioned next to the column heading. This is fine for the tabular style that Don's samples used. However, I wanted to use a grid-style datawindow to allow my users to resize columns while the application is running. Unfortunately, the datawindow tries to resize the bitmap when the column is resized, makin...

how to write loop expression in Datawindow Expression?
thx "handi" <> wrote in message news:3f5d9d07$1@forums-1-dub... > thx > Loop? Can you give us a better idea of what you're trying to accomplish? -- Paul Horan[TeamSybase] Get the new PB9 books! Code samples on Sybase CodeXchange: ISUG Enhancement Requests: Write a global function and refer to it in the dw expression. --- PowerObject! > thx > > <PowerObject!> wrot...

datawindow expressions using datacolumns from other datawindows
Is there a possibility to access datacolumns from other datawindows from a datawindow expression. In fact, I have two datawindows which have a master/detail-relation. For example I want to set a columns visible or protect property in the detail dw depending on the datavalue of a column in the master dw. Thanks Martin Martin, There is no direct way. You could, however, write a couple global functions... one to set a value, one to get a value (then call these from a computed field in the DW)... but you're probably better off doing this in a script. HTH, Greg -- ...

Can DataWindow.Data.HTMLTable handle DataWindow expressions ?
Hi there, I have a couple of DWs that I am saving as HTML. I use 'DataWindow.Data.HTMLTable' to get the html (I've also tried data.html). I prifix this with the StyleSheet in order to get the layout correct i.e. bold, colours etc.. One DW is very simple and works no problem. The other (external) DW is very complicated and has loads of columns. Depending on various column data values, all the columns have expressions to control things like x and coords, height, width, visibility etc.. When I get the HTML the layout is not correct. Some column are not displayed when the...

Use DataWindow Object Properties in DataWindow Object Expression
Hi all, Can I make use of the properties of objects in the expression? For example, can I set an expression in COLUMN_A's color property which reference the color property of COLUMN_B. I don't know how to access properties in expressions. Can anyone help me? Thanks. Alex You can use the Describe() function. Alex wrote in message <>... >Hi all, > Can I make use of the properties of objects in the expression? >For example, can I set an expression in COLUMN_A's color property which >reference the color property of...

Anything Like GetColumn() datawindow method in DataWindow expression function
Hi All, I'm Using PB703 Build 10213 I'd like to know if there is any DataWindow expression function that could give me the current Column on the DataWindow! Sthg like GetColumn() method is script! I've got a tabular datawindow, where I want to change the Border of a column when it is the current column (Just for the current row, too)! Is there any other way to do It? Thanks Check your event arguments for "DWO". That is a pointer to the current column. To check the name for example: ls_var = Hope that helps. regards ... Chris ...

datawindow expression
I'm trying to do something that sounded so simple, but I cannot figure it out. I want to change the background color of a "cell" in a grid datawindow when it has focus. Not the background color of the entire column or row - just the cell which represents the current row and column. I cannot find any datawindow function that tells me the current column. Can it be determined with the Describe function? I tried "GetColumnName" inside a Describe, and of course that is not valid. All the datawindow functions seem to apply to rows, not columns. Does anyone ha...

Datawindow, Protect property, add datawindow expression to control setting
There is already a Protect property for datawindow columns which can be an expression. Did you mean the ReadOnly property of the whole datawindow? Matthew Chestnut wrote in message <>... Oops, I was in a hurry when I entered this ... I meant to request an expression on the *Required* attribute for a datawindow column. On Thu, 7 Mar 2002 14:48:33 -0500, "Jerry Siegel" <> wrote: >There is already a Protect property for datawindow columns which can be an >expression. Did you mean the Re...

DataWindow This, DataWindow That...
Blah blah blah You've heard it enough that you don't even want to comment on how many times... The DataWindow. ....but it can't be enough anymore...can it? This from one of our colleagues (and yes my apologies for taking it out of context)... "...PB covers all you need to do that in ONE Tool. This includes Windowprogramming ( meaning the interface to the user: Windows, Sheets, diallougeboxes, etc.), Database operability AND Reporting! Well, I see als well as many other PB users that some of the implementations and features PB offers are improvable. But thi...

datawindow expression
Hi, I made an expression on my datawindow level : for example the border expression : if(order_ind>0,5,1) Now I want to get this syntax via script on my window level ... How can I do this so that I can also put this or another expression back to the datawindow expression ? This.Describe("order_ind.Border") This also gives me data in the field, but what do I have to do to get only the expression ? Thnx in advance You should post this in the powerbuilder.datawindow section. On 14 Oct 2004 05:41:24 -0700, Dave wrote: >Hi, > >I made an expressio...

What generals generally do
Reading a McChrystal thread elsewhere, I came across someone quoting a US general > I spent 33 years and four months in active military service and > during that period I spent most of my time as a high class thug for > Big Business, for Wall Street and the bankers. In short, I was a > racketeer, a gangster for capitalism. I helped make Mexico and > especially Tampico safe for American oil interests in 1914. I helped > make Haiti and Cuba a decent place for the National City Bank boys to > collect revenues in. I ...

datawindow expression
In PowerBuilder a datawindow expression can call a global function. Is there a similar possibility/feature in DataWindow .NET? Thanks j. Not at this point. On 17 Aug 2004 02:54:20 -0700, jan wrote: >In PowerBuilder a datawindow expression can call a global >function. Is there a similar possibility/feature in >DataWindow .NET? > >Thanks > >j. ...

Web resources about - Datawindow Expressions - sybase.powerbuilder.general

Closed-form expression - Wikipedia, the free encyclopedia
In mathematics , an expression is said to be a closed-form expression if it can be expressed analytically in terms of a finite number of certain ...

Fighting abuse to protect freedom of expression
We believe that protection from abuse and harassment is a vital part of empowering people to freely express themselves on Twitter. Today, as ...

Apple acquires ‘Emotient’ facial expression & emotion detection technology
The Wall Street Journal reports Apple has confirmed it has made an acquisition of artificial intelligence startup Emotient . The cloud-based ...

Joe Rogan's Facial Expression After Ronda Rousey Got Knocked Out Was Priceless - Bleacher Report
Joe Rogan 's face spoke for us all Saturday night. After UFC superstar Ronda Rousey got knocked out by a lethal kick from Holly Holm, the commentator ...

Make your technology a force for musical expression with this digital guitar
Computers, tablets, even iPhones have grown into powerful tools for music making, but for many who play guitar the bridge from analog instrument ...

Disney's FaceDirector changes facial expressions in movies
The new tool out of Disney Research's labs could turn an ing&eacute;nue's semi-decent attempt into a finely nuanced performance. This software ...

Apple Buys A Startup That May Help It Read Your Facial Expressions
The Emotient software could be used to make Siri more aware of the moods of her human masters. Apple wants its devices to understand the emotional ...

Redbubble, A Profitable Channel For Artistic Expression
There is a growing movement of people who never want to follow a trend. Instead they embrace their own creative self-expression and are just ...

Expressions of Solidarity for France in Red, White and Blue
ABC News Expressions of Solidarity for France in Red, White and Blue ABC News This photograph made available on Saturday Nov. 14, 2015, shows ...

Black Activist Shows His Freedom Of Expression By Punching Christian Preacher In University Of Missouri’s ...
A black activist at the University of Missouri showed his “freedom of expression” towards a Christian pastor who was in the midst of protests. ...

Resources last updated: 1/9/2016 3:16:56 PM