Filtering Child ListView


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
A couple of things.  FIrst of all, you will need to have a PK in order to setup any type of parent/child relationship in order for their to be a foreign key constraint.  Otherwise, you will have to create your own Fill method to populate.  Secondly, if you have a filter applied and BO already populated with data, then you will want to use the CopyDataFrom method on the BO rather than requerying the database.  If you already have the records loaded in another BO and want to populate a combo or other SF list, then you will want to setup the list to call the CopyDataFrom method and then pass over the already filtered/populated BO.  There are a lot of samples of this, but you can look at the StrataFlix sample and anywhere you see a child listview it will be populating like this.  If this doesnt' get you going then let us know and we will try and give more details and steer you in the right direction.
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Well, how do you have a Parent/Child table without a primary key field?



The BO has a Filter property which accepts a "Where" condition, but that is not optimal in your case, also you can create your own FillBy... method in the BO using your own SQL statement to grab the data and use that method to populate the childview, but you must have a FK field to filter the child table.



About using VFP tables, that is something I have not done yet, but I know others do including the SF Team, so look in the forum if you need help on how to setup the VFP connection.

Edhy Rijo

Carla Bewley
Carla Bewley
StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)
Group: Forum Members
Posts: 4, Visits: 48
Something I forgot to mention in my initial post is that I'm using a VFP.DBC for my database. I do not have a primary key on the Ticket table. I tried using code similar to that in the ComboBox example but I'm getting an error message when I try to open the TicketHdr form. I'm not sure if it's because I don't have a primary key or because it doesn't like the fact that the Ticket field is a 5 digit numeric which SF has converted to Decimal. I suspect the latter based on the error message.
Attachments
ListView Error.gif (82 views, 35.00 KB)
Carla Bewley
Carla Bewley
StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)
Group: Forum Members
Posts: 4, Visits: 48
Oops. That's what I get for changing my thought mid sentence. I meant to say I don't think I am able to use the FillByPrimaryKey. Thanks for the sample. I'll check it out.
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Carla Bewley (05/07/2009)
... I don't think I am unable to use any of the standard FillByPrimaryKey methods because the primary key is a 5 digit numeric.


Humm, I don't quite understand your statement above, but take a look at the attached sample application, I believe it was created by Trent. This application shows how to configure the ComboBox and ListView to show related data, it should give you all information you need to setup your application with a similar scenario.

Edhy Rijo

Attachments
ComboBoxSample.zip (83 views, 883.00 KB)
Carla Bewley
Carla Bewley
StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)
Group: Forum Members
Posts: 4, Visits: 48
Hi Edhy,

Thank you, I did look at that post however I don't think I am unable to use any of the standard FillByPrimaryKey methods because the primary key is a 5 digit numeric. I've been reading posts on the Forum and you're right it is a good source of imformation. I will try your suggestion of searching on ListView. Smile

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Carla and welcome to the forums.



Take a look at this post which has some code related to your needs:



http://forum.strataframe.net/FindPost23040.aspx



Also do a search in the forums using "listview" or some other key words. The forum is a great resource for many sample code to help you out at any time.

Edhy Rijo

Carla Bewley
Carla Bewley
StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)
Group: Forum Members
Posts: 4, Visits: 48
I'm new to SF with a background in VFP/VFE. I'm trying to recreate a little app I recently wrote for a client as a means of evaluating/learning SF. I have a form set up for the TicketHdr table with a ListView on it for the Ticket (child) records. If I use the FillByParent(BusinessLayer) method to populate the ListView I get all of the child records instead of just the ones associated with the current TicketHdr. I've tried a variety of things and can't seem to come up with the right combination to properly display the child records. TIA
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search