Filtering a Child Browse on an Unrelated Parent Field

Tags: #<Tag:0x00007f202248a3c0> #<Tag:0x00007f202248a258>

Version:1.0 StartHTML:0000000168 EndHTML:0000002191 StartFragment:0000000438 EndFragment:0000002174

Hello, I have been trying to filter a child browse on an unrelated parent field for several days and am failing miserably. I believe it is possible, but must be missing something. I have a parent browse, ‘Orders’ which has a check box called ‘Shipped’ There are two tabs that the browse resides on, one shows orders that have not shipped and the other shows orders that have shipped. There is a related, one to many, child file, ‘Items’, browse. The ‘Items’ file contains a field ‘Lot Number’ (among other fields). The files are related by the parent ID, an autoincremented, unsigned long. The defaullt view is a normal one-to-many relationship. What I’m trying to do is list all of the lots in the child window using a check box that toggles between the default one-to-many view and a view that shows all lots on the child browse, but still maintains the shipped orders on one tab and the ordres that have not shipped on the other tab. Everything works except for this behavior of keeping the shipped and not shipped orders on the separate tabs when the show all lots(or items) checkbox is checked.

The server-side is MSSQL. Using C10. I’ve tried several different multi-key relationships to no avail. I’ve tried embedding SQL statements in the SetFilter and ResetBrowse embeds, also to no avail.

I’ve beed using Clarion since 2.0 for DOS, but it’s not my primary hat, so I’m away from the development for months at a time, and therefore am not as proficient as I’d like to be.

Any help would be greatly appreciated.

Thanks in advance.

Without perhaps understanding all of your requirements, my suggestion would be to first construct 2 views in MSSQL that return exactly what you expect in your App. Once you have verified these results, I would determined whether the views can easily be replicated using Clarion joins & filters OR whether the MSSQL views should be added to the DCT.

A final point to remember is that your browse is using the same View declaration & queue on both tabs. Switching tabs must reset all filters and completely refill the queue each time.

HTH

So let get this straight. you have 3 browses, 2 of the orders file on tabs using different filters. One on the window for the Items. I assume the items has a filter based on the selected order?
Now. Does the Items browse also include the order in the datapad? If so I’d remove it because that would just confuse things when you went to lots, the orders buffer would change. Is that the problem?

Thank you both for your replies. I see that my original description was a bit confusing. To clarify, there are only two browses. They are both placed on the Sheet so that they both show on both tabs. The parent browse is Orders and the child browse is Items (Orders <—>> Items). Inside the Orders file is a checkbox field called Shipped(Ord:Shipped) as a Byte. The Items browse does not have the Orders file in the datapad.

The first tab shows only Orders that have not shipped and the second tab shows orders that have shipped.

The Items file has a field for lot numbers, which is visible in the browse. It is desired by the end users to be able to also search all lot numbers.

I have a check box called ‘All Lots’, that also shows on both tabs below the browse boxes.

There are four filter conditions on the Items browse.

The Default Behavior is:

Record Filter: Ord:Shipped = 0

Range Limit Field: Ite:ID_Orders

Range Limit Type: File Relationship

Related File: Orders

All Lots check box is unchecked.

Default Behavior works fine.

There are three Conditional Browse Behaviors:

(CHOICE(?CurrentTab) = 1) AND (AllLots = 1)

Record Filter: Ord:Shipped = 0

Range Limit Field: None

(CHOICE(?CurrentTab) = 2) AND (AllLots = 0)

Record Filter: Ord:Shipped = 1

Range Limit Field: Ite:ID_Orders

Range Limit Type: File Relationship

Related File: Orders

All Lots check box is checked.

This condition works fine.

(CHOICE(?CurrentTab) = 2) AND (AllLots = 1)

Record Filter: Ord:Shipped = 1

Range Limit Field: None

Conditions 1 and 3 do not work. I see why, but am having difficulty in finding the solution.

I want the child browse, Items, to only show those items\lots that have not shipped on tab 1 and all of the lots that have shipped on tab 2. The filter is the Ord:Shipped field in the parent file. In order for the Items browse to show all of the lots, I have no range limit field. I have tried to create keys that would allow this behavior, but with no success. I have tried to send an SQL statement to the backend, that does give the correct data set when used in the SQL Management Console. I do not have experience in adding MSSQL views to the DCT, but maybe that’s what I need?

Thanks again for any and all help.

OK. Thanks I think I understand now.
I think the problem you’re having is the triggering of the appropriate code. ie the choice stuff only happens when you change tabs. Does it work if you set AllLots and flick tabs a couple of times?

Might I suggest 4 tabs, 1 for each scenario and remove the AllLots checkbox entirely.