Welcome! Log In Create A New Profile

Advanced

Report based on a table...

Posted by DarrenF 
DarrenF
Report based on a table...
November 10, 2008 02:18AM
Hi guys,

I have a window maintaining customer details. I have created a report based on a table. One of the fields of my customer file is a boolean to indicate if the customer is currently active.

My question is; How do I filter out the inactive customers on my report using the "Filter (process record?) event of the report.

I tried something like:

IF Customer_Details.bActive = False THEN
	RESULT(False)
ELSE
	RESULT(True)
END

...without success :confused:

I get the following error but I'm a bit unsure how the subscript processing works in the context of a report based on a table:

Error at line 2 of Filter (process record?) of Report_Customer_Details process.
Subscript required to access array item (<Customer_Details.bOnReports>).


Any help would be much appreciated...

Christoph Erdmann
Re: Report based on a table...
November 10, 2008 07:32AM
Hello Darren,
write result true and result false without brackets.
Christoph
DarrenF
Re: Report based on a table...
November 10, 2008 08:23PM
Christoph,

Many thanks for your reply...

I think because the data item of Customer_Details.bOnReports was enclosed in greater than/less than (chevrons), it mean it was missing from the error message text :rolleyes:

Although the RESULT() syntax was incorrect (well spotted), the error message should have read:

Error at line 2 of Filter (process record?) of Report_Customer_Details process.
Subscript required to access array item (Customer_Details.bOnReports).

I think this is now my original question - how to code and therefore access a subscript of the Customer_Details.bOnReports data item?

Cheers...
Christoph Erdmann
Re: Report based on a table...
November 11, 2008 07:44AM
Hi Darren,

maybe Customer_Details.bOnReprorts[1] is possible if you have a field in the database with subscript.

Christoph
DarrenF
Re: Report based on a table...
November 11, 2008 10:47AM
Hi Christoph,

Yes, I was thinking the same - I think what I'm asking for is the WD internal subscript that it uses when processing database rows...

Does anyone know what this internal subscript variable is called and how to access it???

Al
Re: Report based on a table...
November 11, 2008 01:59PM
Hello Darren

You need to be really specific in asking for help about tables. Windev has file based browse tables, memory tables and some forum members refer to database files as tables and for your problem you would get different answers depending on what sort of "table" you are using.


When you base a report on a table you can either set it to run from all records in the table or the selected records.

If you are running from a browsing table then you may be out of luck because it cannot function as a multi select table in some cases. If you run from a memory table then you can set it up as a multi select table and then using tableselectplus() select the rows you want to report on. However, I have tried this a few times and have never been able to get the multi select to work, so I normally dump just the records I want into a memory table and report all of them.


Regards
Al.



Edited 1 time(s). Last edit at 11/11/2008 02:14PM by Al.
DarrenF
Re: Report based on a table...
November 11, 2008 03:32PM
Thanks Al,

I thought I was being specific, but as you point out, there are broswed or memory tables.

I had made the assumption that if there was a filter event on the report, then the data items of the file being reported on, would automatically be available to me to "simply" process.

Looking at your write-up, it's not that simple, which I was very slowly realising...

I am indeed running this from a browsed table, so if (when the "Print" button is pressed), I "dump" the rows that I want to appear on the report into a memory table and then report on the memory table contents...

Alternatively, I suppose I could just create a reoprt with a query... at least then, I could re-use them wherever needed smiling smiley

Thanks...

Christoph Erdmann
Re: Report based on a table...
November 11, 2008 07:00PM
Hi Darren,

what do you use : HF Classsic ? I think your problem is, that the field in the database Customer_Details.bOnReprorts is a field with a subscript. In HF this is possible.

Christoph
DarrenF
Re: Report based on a table...
November 11, 2008 08:09PM
Hi Christoph,

That's interesting - yes, I use HF classic.

You got me thinking - so I looked and looked, and looked some more...

It's in the Analysis - somehow (some sausage fingered coder - me!), has somehow managed to tick the "Table" check box on the "General" tab of the "Describing the File Items" window.

The effects of checking this check box can also be seen in the boolean control on the window. If you go to the Link tab on the "Describing a radio button/check box" window, there are 2 entries in the list... in my case bOnReports boolean is listed as:

bOnReports[1]
bOnReports[2]

I'd noticed this previously and wondered why and how this was happening. It also shows itself in WDMAP as 2 separate fields.

Needless to say, I've unchecked the "Table" checkbox and re-gened the Analysis - and there we have it... it's all working as I expected - taking the Filter event into account - perfect! :cool:

Thanks Christoph! You deserve a gold star winking smiley
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: