Duplicate fields in TypedList?

Posts   
 
    
edalzell
User
Posts: 44
Joined: 27-May-2008
# Posted on: 04-Sep-2008 01:58:54   

I have a a TypedList that pulls in 4 entities (Type, RelatedForms, Form, Form). Each of those is a sub-type of TrackerObject, which contains an IsDeleted field, so therefore I have 4 IsDelete fields in my TypedList.

I don't want to expose the IsDeleted field, but I do want to filter it. More specifically I want to filter the ChildForm.IsDelete (vs the ParentForm.IsDeleted).

Any ideas?

edalzell
User
Posts: 44
Joined: 27-May-2008
# Posted on: 04-Sep-2008 02:02:04   

Here what I want, with the missing code in bold:

   public AllRelatedFormsTypedList RetrieveRelatedForms(long typeId)
    {
        using (DataAccessAdapter adapter = new DataAccessAdapter())
        {
            AllRelatedFormsTypedList clientTypedList = new AllRelatedFormsTypedList();
            IPredicateExpression filter = new PredicateExpression();
            filter.Add(TypeFields.TypeId == typeId);
            filter.Add(**CHILDFORM.IsDeleted** == false);

            adapter.FetchTypedList(clientTypedList, filter);

            return clientTypedList;
        }
    }
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 04-Sep-2008 06:58:54   

You should add the Super relation manually to be able to filter on it. Please try this code:

public AllRelatedFormsTypedList RetrieveRelatedForms(long typeId)
{
     using (DataAccessAdapter adapter = new DataAccessAdapter())
     {
          AllRelatedFormsTypedList clientTypedList = new AllRelatedFormsTypedList();
          IRelationPredicateBucket filter = clientTypedList.GetRelationInfo();
          filter.Relations.Add(ChildFormEntity.Relations.GetSuperTypeRelation());

          filter.Add(TypeFields.TypeId == typeId);
          filter.Add(CHILDFORM.IsDeleted == false);

          adapter.FetchTypedList(clientTypedList.GetFieldsInfo(), clientTypedList, filter);

          return clientTypedList;
     }
}
David Elizondo | LLBLGen Support Team
edalzell
User
Posts: 44
Joined: 27-May-2008
# Posted on: 04-Sep-2008 18:07:01   

Error 1 The name 'ChildFormEntity' does not exist in the current context C:\Evolution\Windows.NET\Libraries\CSRS\Evolution\FacilityTrack\BSL\FacilityTrackService.cs 194 38 CSRS.Evolution.FacilityTrack.BSL Error 2 'SD.LLBLGen.Pro.ORMSupportClasses.IRelationPredicateBucket' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'SD.LLBLGen.Pro.ORMSupportClasses.IRelationPredicateBucket' could be found (are you missing a using directive or an assembly reference?) C:\Evolution\Windows.NET\Libraries\CSRS\Evolution\FacilityTrack\BSL\FacilityTrackService.cs 196 24 CSRS.Evolution.FacilityTrack.BSL Error 3 'SD.LLBLGen.Pro.ORMSupportClasses.IRelationPredicateBucket' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'SD.LLBLGen.Pro.ORMSupportClasses.IRelationPredicateBucket' could be found (are you missing a using directive or an assembly reference?) C:\Evolution\Windows.NET\Libraries\CSRS\Evolution\FacilityTrack\BSL\FacilityTrackService.cs 197 24 CSRS.Evolution.FacilityTrack.BSL Error 4 The name 'ChildForm' does not exist in the current context C:\Evolution\Windows.NET\Libraries\CSRS\Evolution\FacilityTrack\BSL\FacilityTrackService.cs 197 28 CSRS.Evolution.FacilityTrack.BSL

edalzell
User
Posts: 44
Joined: 27-May-2008
# Posted on: 04-Sep-2008 18:29:23   

I should have been more specific. ChildForm is the ALIAS I gave one (of the two) Form Entities. The other I named ParentForm. So both of those are FormEntities.

Not sure if that information is relevant.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 05-Sep-2008 06:49:10   

Could you please post the real names of all involved entities in the fetch? Also please post the code you have so far.

David Elizondo | LLBLGen Support Team
edalzell
User
Posts: 44
Joined: 27-May-2008
# Posted on: 05-Sep-2008 17:52:02   

I am not sure what you meant by "real names" of all the entities involved. I posted my original code (the CHILDFORM in bold was pseudo code).

My issue stems from the multiple FormEntities in my TypedList. I have one of the them the name ParentForm (in the alias field in LLBLGen) and the other ChildForm.

I want to filter on ChildForm.IsDeleted, but ChildForm does not exist in the generated code. How do I reference the aliased entity?

Which code do you want me to post?

Thanks for your patience

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 06-Sep-2008 06:35:13   

Sorry, I don't get you 100%. Anyway the rule is: if the entity isn't included in typedList design, then add the relation that connect the included entity with the missing one, then you can add the filter based on that field entity.

edalzell wrote:

I want to filter on ChildForm.IsDeleted, but ChildForm does not exist in the generated code.

So, ChildForm isn't mapped at LLBLGenPro designer (therefore, ChilFormEntity doesn't exist at generate code)?

David Elizondo | LLBLGen Support Team
edalzell
User
Posts: 44
Joined: 27-May-2008
# Posted on: 06-Sep-2008 20:40:41   

You know how you can give Entities aliases in the TypedList Designer? I have two Form Entities, one of which I named ParentForm and one I named ChildForm. These are named from within the designer and used in the mapped fields properties when I select the properties from ChildForm.

Would screenshots help?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 07-Sep-2008 12:23:06   

edalzell wrote:

You know how you can give Entities aliases in the TypedList Designer? I have two Form Entities, one of which I named ParentForm and one I named ChildForm. These are named from within the designer and used in the mapped fields properties when I select the properties from ChildForm.

Would screenshots help?

I don't know which version you're using (you didn't tell that to use), but if you look at the TypedList docs you'll see where the aliases are specified, in the first screenshot. simple_smile (at the top right)

Frans Bouma | Lead developer LLBLGen Pro
edalzell
User
Posts: 44
Joined: 27-May-2008
# Posted on: 08-Sep-2008 16:44:58   

Yes, I have the aliases defined in the designer, as ParentForm and ChildForm, respectively.

My issue is that I can't filter on a field from the ChildForm, because I don't know how to specify a ChildForm field.

I feel like we aren't quite understanding each other...how can I help explain my situation better?

I have attached my LLBLGen Proj and the generated code. What I want to do is add a filter for ChildForm.IsDeleted. However the ChildFormEntity doesn't exist (I suspect because it is an alias).

edalzell
User
Posts: 44
Joined: 27-May-2008
# Posted on: 08-Sep-2008 16:45:56   

Can only attach on file at once...here is the generated code.

Attachments
Filename File size Added on Approval
AllRelatedFormsTypedList.cs 26,352 08-Sep-2008 16:46.14 Approved
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 08-Sep-2008 17:06:50   

I don't know which version you're using (you didn't tell that to use)

Could you for once please PLEASE answer this question? We can't proceed without this info. simple_smile http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=7725

i.e.: designer build date, runtime lib build nr.

Frans Bouma | Lead developer LLBLGen Pro
edalzell
User
Posts: 44
Joined: 27-May-2008
# Posted on: 08-Sep-2008 17:18:25   

So sorry,

I am using 2.6 Final.

edalzell
User
Posts: 44
Joined: 27-May-2008
# Posted on: 08-Sep-2008 17:20:15   

Build date, June 6, 2008

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 08-Sep-2008 17:23:10   

Please try to specify the alias in the predicate as follows:

filter.Add(FormFields.IsDeleted.SetObjectAlias("ChildForm") == false);
Cleaner007
User
Posts: 1
Joined: 10-Sep-2008
# Posted on: 10-Sep-2008 23:30:06   

As for duplicates i use some interesting and very simple (not primitive) program - Clone Remover. Very wellsmile ! These guys are here - http://www.moleskinsoft.com/.