Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Filter and SetFilter use

2 views
Skip to first unread message

John Hall

unread,
Aug 14, 1997, 3:00:00 AM8/14/97
to

Dave Morse wrote:
>
> HELP! I'm trying to code a VERY EASY task. However, I can't get my code
> to work. I have two DDDW's ('job' and 'mini_run_date'). I'm trying to
> filter the '..date' field based on the 'job' selected (because there may be
> numerous dates for the one job). Check this out and tell em if I'm all wet
> with it:
>
> ----------------------------------------------------------------------------
> ----------------------------------------------------
> ////// ItemChanged event of datawindow control ///////
>
> ls_colname = dwo.Name // 'dwo' is argument used in ItemChanged event to
> retrieve changed item
>
> CHOOSE CASE ls_colname
> CASE "job"
> ls_job = data
> ls_filter = "job = " + " ' " + ls_job + " ' "
> IF this.GetChild("mini_run_date",ldwc_date) > 0 THEN
> ldwc_date.SetFilter(ls_filter)
> ldwc_date.Filter()
> ll_currow = ldwc_date.ScrollToRow(ldwc_date.GetRow())
> this.ScrollToRow(ll_currow)
> this.SetText(ls_job)
> ELSE
> MessageBox("No Records","There are no records for job " + ls_job)
> END IF
> ----------------------------------------------------------------------------
> ----------------------------------------------------
> I put a message box in right after the SetFilter() statement to check the
> return code, and it's a -1 (failed!!) Is it a problem with the syntax of
> the Filter argument? I put a message box right after 'ls_filter' to check
> the contents of the expression and it's good as well.
>
> I'll give you four weeks of my pay if you help me (just kidding - I earn
> minimum wage)!!
> --
> Dave Morse
> Analyst/Programmer
> Cooper Tire & Rubber Co.
> dave_...@cooper-epd.com

I don't think it would cause SetFilter() to fail, but I would think that
the spaces surrounding ls_job and at the statement end would be
incorrect. If ls_job was "test", the statement would evaluate to "job =
_'_test_'_" (underscores indicate unwanted spaces). The code should
probably read
ls_filter = "job = '" + ls_job + "'"
You might try putting tildes (~) in front of the single quotes, but I
use similar filter statements that don't require them.

I am assuming that job is the correct column name on the DW and the DDDW
(check the properties) and that job is a string in both the main DW and
DDDW. If not, change your filter to check for the correct column
name/data type. Numeric would not be surrounded by quotes.

After that, I'm clueless (I have been accused of that before).

HTH
--
John Hall (JohnX_...@ccm.ch.intel.com)

Dave Morse

unread,
Aug 14, 1997, 3:00:00 AM8/14/97
to

Daryl E. Anderson, Sr.

unread,
Aug 14, 1997, 3:00:00 AM8/14/97
to

I may be missing something; but everything looks good to me. The one thing
I would suggest is to be sure that you are using the correct column name in
the filter expression: from your syntax, there should be a string column
named 'job' in the dddw.

--
Daryl E. Anderson, Sr., CPD-P
dande...@mindspring.com

Dave Morse <dave...@kih.net> wrote in article
<01bca8e2$c6a4dde0$2d6409a0@dave-morse>...

Diane Diesh

unread,
Aug 14, 1997, 3:00:00 AM8/14/97
to Dave Morse

Dave Morse wrote:
>
> HELP! I'm trying to code a VERY EASY task. However, I can't get my code
> to work. I have two DDDW's ('job' and 'mini_run_date'). I'm trying to
> filter the '..date' field based on the 'job' selected (because there may be
> numerous dates for the one job). Check this out and tell em if I'm all wet
> with it:
>
> (script omitted)

Your filter string will come out something like:
job = ' <value of ls_job> '
that is, there are embedded spaces on the inside
of the single quotes. Could that be your problem?

Werner Fangmeier

unread,
Aug 19, 1997, 3:00:00 AM8/19/97
to

Dave/Diane,

"job = ' xxx '" is a syntactically correct filter expression and
should not make SetFilter() fail! I think the problem lies in the
column names of the DDDW.

If Dave's filter is correct, the table 'job' must contain a
column with the same name (impossible in many DBMSs).

This makes me assume, that the problem lies on the LEFT side of the
filter and not on the right hand side.

The column names IN the DDDW might be totally different. For 'job'
I would expect 'job_id' and 'job_description' or kind of this...
In general these names are identical to the column
names of the 'job' table in Dave's DB.

But another BIG warning to Dave!!!

It's an ever-returning problem to filter one DDDW based on values
in another column. But BE CAUTIOUS! This task is not easy to
accomplish, for there is only ONE dddw buffer for all rows. I do not
want to get into this to deeply, but if you search the web for
dropdowndatawindow PowerBuilder issues you'll find some very good
resources for this area. Also see http://www.powersoft.com and
search the technical documents.

HTH, Werner

Carl Williams

unread,
Aug 20, 1997, 3:00:00 AM8/20/97
to Dave Morse

This is a multi-part message in MIME format.
--------------82495C7C1BD8206044864543
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Dave Morse wrote:

> HELP! I'm trying to code a VERY EASY task. However, I can't get my code
> to work. I have two DDDW's ('job' and 'mini_run_date'). I'm trying to
> filter the '..date' field based on the 'job' selected (because there may be
> numerous dates for the one job). Check this out and tell em if I'm all wet
> with it:
>

Is 'job' A number or a string. I had a similar case where i did a find for a number
putting the quotes around the number and it didn't work. When i took them out it did
work !!

so try ls_filter = "job = " + ls_job

And see if that works.

HTH


--------------82495C7C1BD8206044864543
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Carl Williams
Content-Disposition: attachment; filename="vcard.vcf"

begin: vcard
fn: Carl Williams
n: Williams;Carl
org: Power Business Systems
adr: Units 19/20 Piccadilly Square;;Cnr Short & Nash Streets;Perth;WA;6000;Australia
email;internet: ca...@power.net.au
title: Systems Consultant
tel;work: +61 89 221 1182
tel;fax: +61 89 325 5198
x-mozilla-cpt: ;0
x-mozilla-html: TRUE
version: 2.1
end: vcard


--------------82495C7C1BD8206044864543--


0 new messages