Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Expression setting dw background color

4 posts in DataWindow Last posting was on 2008-07-16 13:29:39.0Z
Steve Posted on 2008-07-15 19:51:39.0Z
From: "Steve" <nobody@home.com>
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Expression setting dw background color
Lines: 52
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <487cffcb@forums-1-dub>
Date: 15 Jul 2008 12:51:39 -0700
X-Trace: forums-1-dub 1216151499 10.22.241.152 (15 Jul 2008 12:51:39 -0700)
X-Original-Trace: 15 Jul 2008 12:51:39 -0700, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:87379
Article PK: 416635

Hi all,

We're using PB10 and have a generic lookup window for various fields in an
application.

My problem is, the code is written to be a generic lookup and adds a
formatting expression after the window is created to change the background
color of rows that users have modified from their stock settings or added
themselves.

This is the expression we add: If(trim(USER_MODIFIED) = 'Y',
RGB(188,188,188), If(trim(USER_MODIFIED) = 'P', RGB(188,188,188),
RGB(255,255,255)))

We then do a dw.modify to apply it.

Everything has been fine until a new req that has certain lookups with two
different columns that effect the background color.

The basic explanation is:
Normal unmodified rows for the 'N' group should be light blue
Normal unmodified rows for the 'M' group should be white
Modified rows for the 'N' group should be gray-ish blue
Modified rows for the 'M' group should be light gray

Modified rows have a Y or P in the user_modified field
Unmodified rows are null or N in the user_modified field

I got this to work wonderfully:

case(trim(GROUP) when 'M'
then If(trim(USER_MODIFIED) = 'Y', RGB(188,188,188), If(trim(USER_MODIFIED)
= 'P', RGB(188,188,188), RGB(255,255,255)))
when 'N' then If(trim(USER_MODIFIED) = 'Y', RGB(100,148,154),
If(trim(USER_MODIFIED) = 'P', RGB(100,148,154), RGB(28,219,239)))
else If(trim(USER_MODIFIED) = 'Y', RGB(188,188,188), If(trim(USER_MODIFIED)
= 'P', RGB(188,188,188), RGB(255,255,255))))

The problem is, any dw that does NOT have GROUP in it, the expression errors
out and I get no highlighting at all. The GROUP column is only in two out
of maybe dozens of lookups.

This code executes in a function that takes a dw argument passed by
reference. So I only have the literal dw to look at. The only thing I can
think of is to test the dw for each of the columns and make expressions to
handle each of them as need be and set accordingly.

Yes? How do I tell if a particular column exists?

Thanks so much for any input.


"Jerry Siegel [TeamSybase]" <jNOsSPAMsiegel Posted on 2008-07-15 20:00:05.0Z
From: "Jerry Siegel [TeamSybase]" <jNOsSPAMsiegel@yahoo!.com>
Newsgroups: sybase.public.powerbuilder.datawindow
References: <487cffcb@forums-1-dub>
Subject: Re: Expression setting dw background color
Lines: 59
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <487d01c5$1@forums-1-dub>
Date: 15 Jul 2008 13:00:05 -0700
X-Trace: forums-1-dub 1216152005 10.22.241.152 (15 Jul 2008 13:00:05 -0700)
X-Original-Trace: 15 Jul 2008 13:00:05 -0700, vip152.sybase.com
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:87381
Article PK: 416637

Describe() is available in expressions, and as I'm sure you recall, returns
! if the requested property is bogus.
IF (describe('group.coltype') = '!', <stuff for DW without group>, <stuff
for DW with group>)

"Steve" <nobody@home.com> wrote in message news:487cffcb@forums-1-dub...
> Hi all,
>
> We're using PB10 and have a generic lookup window for various fields in an
> application.
>
> My problem is, the code is written to be a generic lookup and adds a
> formatting expression after the window is created to change the background
> color of rows that users have modified from their stock settings or added
> themselves.
>
> This is the expression we add: If(trim(USER_MODIFIED) = 'Y',
> RGB(188,188,188), If(trim(USER_MODIFIED) = 'P', RGB(188,188,188),
> RGB(255,255,255)))
>
> We then do a dw.modify to apply it.
>
> Everything has been fine until a new req that has certain lookups with two
> different columns that effect the background color.
>
> The basic explanation is:
> Normal unmodified rows for the 'N' group should be light blue
> Normal unmodified rows for the 'M' group should be white
> Modified rows for the 'N' group should be gray-ish blue
> Modified rows for the 'M' group should be light gray
>
> Modified rows have a Y or P in the user_modified field
> Unmodified rows are null or N in the user_modified field
>
> I got this to work wonderfully:
>
> case(trim(GROUP) when 'M'
> then If(trim(USER_MODIFIED) = 'Y', RGB(188,188,188),
> If(trim(USER_MODIFIED) = 'P', RGB(188,188,188), RGB(255,255,255)))
> when 'N' then If(trim(USER_MODIFIED) = 'Y', RGB(100,148,154),
> If(trim(USER_MODIFIED) = 'P', RGB(100,148,154), RGB(28,219,239)))
> else If(trim(USER_MODIFIED) = 'Y', RGB(188,188,188),
> If(trim(USER_MODIFIED) = 'P', RGB(188,188,188), RGB(255,255,255))))
>
> The problem is, any dw that does NOT have GROUP in it, the expression
> errors out and I get no highlighting at all. The GROUP column is only in
> two out of maybe dozens of lookups.
>
> This code executes in a function that takes a dw argument passed by
> reference. So I only have the literal dw to look at. The only thing I
> can think of is to test the dw for each of the columns and make
> expressions to handle each of them as need be and set accordingly.
>
> Yes? How do I tell if a particular column exists?
>
> Thanks so much for any input.
>


Steve Posted on 2008-07-16 12:51:54.0Z
From: "Steve" <nobody@home.com>
Newsgroups: sybase.public.powerbuilder.datawindow
References: <487cffcb@forums-1-dub> <487d01c5$1@forums-1-dub>
Subject: Re: Expression setting dw background color
Lines: 97
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <487deeea$1@forums-1-dub>
Date: 16 Jul 2008 05:51:54 -0700
X-Trace: forums-1-dub 1216212714 10.22.241.152 (16 Jul 2008 05:51:54 -0700)
X-Original-Trace: 16 Jul 2008 05:51:54 -0700, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:87387
Article PK: 416643

Jerry,

I have limited background on expressions so thank you for pointing out
describe.

My problem is I'm still stuck in the same spot.

Each piece of the expression works on it's own AND it works exactly as
planned when GROUP is present. I still get zero formatting when GROUP is
not.


IF(describe('GROUP.coltype') = '!',
If(trim(USER_MODIFIED) = 'Y', RGB(188,188,188), If(trim(USER_MODIFIED) =
'P', RGB(188,188,188), RGB(255,0,0))),
case(trim(GROUP)
when 'M' then If(trim(USER_MODIFIED) = 'Y', RGB(188,188,188),
If(trim(USER_MODIFIED) = 'P', RGB(188,188,188), RGB(255,255,255)))
when 'N' then If(trim(USER_MODIFIED) = 'Y', RGB(100,148,154),
If(trim(USER_MODIFIED) = 'P', RGB(100,148,154), RGB(28,219,239)))
else If(trim(USER_MODIFIED) = 'Y', RGB(188,188,188), If(trim(USER_MODIFIED)
= 'P', RGB(188,188,188), RGB(255,255,255)))))

With the above I get a white background on a lookup with only user_modified.
If I take the IF statement out of the TRUE section of the first IF (meaning
describe returned a !) and only use that as the expression, it works.
Meaning this: If(trim(USER_MODIFIED) = 'Y', RGB(188,188,188),
If(trim(USER_MODIFIED) = 'P', RGB(188,188,188), RGB(255,0,0)))

So I either have a formatting problem or logic error that I just can not for
the life of me see. When I take the above and put it into a dw detail
seciton in the editor, if both group and user_mod is present, it gets
verified and it works fine.

"Jerry Siegel [TeamSybase]" <jNOsSPAMsiegel@yahoo!.com> wrote in message
news:487d01c5$1@forums-1-dub...
> Describe() is available in expressions, and as I'm sure you recall,
> returns ! if the requested property is bogus.
> IF (describe('group.coltype') = '!', <stuff for DW without group>, <stuff
> for DW with group>)
>
> "Steve" <nobody@home.com> wrote in message news:487cffcb@forums-1-dub...
>> Hi all,
>>
>> We're using PB10 and have a generic lookup window for various fields in
>> an application.
>>
>> My problem is, the code is written to be a generic lookup and adds a
>> formatting expression after the window is created to change the
>> background color of rows that users have modified from their stock
>> settings or added themselves.
>>
>> This is the expression we add: If(trim(USER_MODIFIED) = 'Y',
>> RGB(188,188,188), If(trim(USER_MODIFIED) = 'P', RGB(188,188,188),
>> RGB(255,255,255)))
>>
>> We then do a dw.modify to apply it.
>>
>> Everything has been fine until a new req that has certain lookups with
>> two different columns that effect the background color.
>>
>> The basic explanation is:
>> Normal unmodified rows for the 'N' group should be light blue
>> Normal unmodified rows for the 'M' group should be white
>> Modified rows for the 'N' group should be gray-ish blue
>> Modified rows for the 'M' group should be light gray
>>
>> Modified rows have a Y or P in the user_modified field
>> Unmodified rows are null or N in the user_modified field
>>
>> I got this to work wonderfully:
>>
>> case(trim(GROUP) when 'M'
>> then If(trim(USER_MODIFIED) = 'Y', RGB(188,188,188),
>> If(trim(USER_MODIFIED) = 'P', RGB(188,188,188), RGB(255,255,255)))
>> when 'N' then If(trim(USER_MODIFIED) = 'Y', RGB(100,148,154),
>> If(trim(USER_MODIFIED) = 'P', RGB(100,148,154), RGB(28,219,239)))
>> else If(trim(USER_MODIFIED) = 'Y', RGB(188,188,188),
>> If(trim(USER_MODIFIED) = 'P', RGB(188,188,188), RGB(255,255,255))))
>>
>> The problem is, any dw that does NOT have GROUP in it, the expression
>> errors out and I get no highlighting at all. The GROUP column is only in
>> two out of maybe dozens of lookups.
>>
>> This code executes in a function that takes a dw argument passed by
>> reference. So I only have the literal dw to look at. The only thing I
>> can think of is to test the dw for each of the columns and make
>> expressions to handle each of them as need be and set accordingly.
>>
>> Yes? How do I tell if a particular column exists?
>>
>> Thanks so much for any input.
>>
>
>


Steve Posted on 2008-07-16 13:29:39.0Z
From: "Steve" <nobody@home.com>
Newsgroups: sybase.public.powerbuilder.datawindow
References: <487cffcb@forums-1-dub> <487d01c5$1@forums-1-dub> <487deeea$1@forums-1-dub>
Subject: Re: Expression setting dw background color
Lines: 107
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <487df7c3$1@forums-1-dub>
Date: 16 Jul 2008 06:29:39 -0700
X-Trace: forums-1-dub 1216214979 10.22.241.152 (16 Jul 2008 06:29:39 -0700)
X-Original-Trace: 16 Jul 2008 06:29:39 -0700, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:87389
Article PK: 416646

Okay using Jerry's info, I moved the describe up into the actual code and
have an IF THEN checking the describe on the dw column and setting the
expression based on that info. This works.

I'm still tweaked as to why the single expression doesn't work.

"Steve" <nobody@home.com> wrote in message news:487deeea$1@forums-1-dub...
> Jerry,
>
> I have limited background on expressions so thank you for pointing out
> describe.
>
> My problem is I'm still stuck in the same spot.
>
> Each piece of the expression works on it's own AND it works exactly as
> planned when GROUP is present. I still get zero formatting when GROUP is
> not.
>
>
> IF(describe('GROUP.coltype') = '!',
> If(trim(USER_MODIFIED) = 'Y', RGB(188,188,188), If(trim(USER_MODIFIED) =
> 'P', RGB(188,188,188), RGB(255,0,0))),
> case(trim(GROUP)
> when 'M' then If(trim(USER_MODIFIED) = 'Y', RGB(188,188,188),
> If(trim(USER_MODIFIED) = 'P', RGB(188,188,188), RGB(255,255,255)))
> when 'N' then If(trim(USER_MODIFIED) = 'Y', RGB(100,148,154),
> If(trim(USER_MODIFIED) = 'P', RGB(100,148,154), RGB(28,219,239)))
> else If(trim(USER_MODIFIED) = 'Y', RGB(188,188,188),
> If(trim(USER_MODIFIED) = 'P', RGB(188,188,188), RGB(255,255,255)))))
>
> With the above I get a white background on a lookup with only
> user_modified. If I take the IF statement out of the TRUE section of the
> first IF (meaning describe returned a !) and only use that as the
> expression, it works. Meaning this: If(trim(USER_MODIFIED) = 'Y',
> RGB(188,188,188), If(trim(USER_MODIFIED) = 'P', RGB(188,188,188),
> RGB(255,0,0)))
>
> So I either have a formatting problem or logic error that I just can not
> for the life of me see. When I take the above and put it into a dw detail
> seciton in the editor, if both group and user_mod is present, it gets
> verified and it works fine.
>
> "Jerry Siegel [TeamSybase]" <jNOsSPAMsiegel@yahoo!.com> wrote in message
> news:487d01c5$1@forums-1-dub...
>> Describe() is available in expressions, and as I'm sure you recall,
>> returns ! if the requested property is bogus.
>> IF (describe('group.coltype') = '!', <stuff for DW without group>, <stuff
>> for DW with group>)
>>
>> "Steve" <nobody@home.com> wrote in message news:487cffcb@forums-1-dub...
>>> Hi all,
>>>
>>> We're using PB10 and have a generic lookup window for various fields in
>>> an application.
>>>
>>> My problem is, the code is written to be a generic lookup and adds a
>>> formatting expression after the window is created to change the
>>> background color of rows that users have modified from their stock
>>> settings or added themselves.
>>>
>>> This is the expression we add: If(trim(USER_MODIFIED) = 'Y',
>>> RGB(188,188,188), If(trim(USER_MODIFIED) = 'P', RGB(188,188,188),
>>> RGB(255,255,255)))
>>>
>>> We then do a dw.modify to apply it.
>>>
>>> Everything has been fine until a new req that has certain lookups with
>>> two different columns that effect the background color.
>>>
>>> The basic explanation is:
>>> Normal unmodified rows for the 'N' group should be light blue
>>> Normal unmodified rows for the 'M' group should be white
>>> Modified rows for the 'N' group should be gray-ish blue
>>> Modified rows for the 'M' group should be light gray
>>>
>>> Modified rows have a Y or P in the user_modified field
>>> Unmodified rows are null or N in the user_modified field
>>>
>>> I got this to work wonderfully:
>>>
>>> case(trim(GROUP) when 'M'
>>> then If(trim(USER_MODIFIED) = 'Y', RGB(188,188,188),
>>> If(trim(USER_MODIFIED) = 'P', RGB(188,188,188), RGB(255,255,255)))
>>> when 'N' then If(trim(USER_MODIFIED) = 'Y', RGB(100,148,154),
>>> If(trim(USER_MODIFIED) = 'P', RGB(100,148,154), RGB(28,219,239)))
>>> else If(trim(USER_MODIFIED) = 'Y', RGB(188,188,188),
>>> If(trim(USER_MODIFIED) = 'P', RGB(188,188,188), RGB(255,255,255))))
>>>
>>> The problem is, any dw that does NOT have GROUP in it, the expression
>>> errors out and I get no highlighting at all. The GROUP column is only
>>> in two out of maybe dozens of lookups.
>>>
>>> This code executes in a function that takes a dw argument passed by
>>> reference. So I only have the literal dw to look at. The only thing I
>>> can think of is to test the dw for each of the columns and make
>>> expressions to handle each of them as need be and set accordingly.
>>>
>>> Yes? How do I tell if a particular column exists?
>>>
>>> Thanks so much for any input.
>>>
>>
>>
>
>