New Posts New Posts RSS Feed: Need some advice on unioning entitylists
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Need some advice on unioning entitylists

 Post Reply Post Reply
Author
BillG View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 05-Dec-2007
Location: Monroe, MI
Posts: 233
Post Options Post Options   Quote BillG Quote  Post ReplyReply Direct Link To This Post Topic: Need some advice on unioning entitylists
    Posted: 26-Apr-2008 at 12:37pm

One of my modules in my app that I am developing is a workflow type piece where a member calls up with a problem and a step by step process is done to complete the solution.  Throughout the process the user selects steps from a drop down list that signify what was done to complete it.  There are two types of steps that can be done, generics steps that can occur in any order throughout the process and specfic steps that have to occur in order and certain steps can only follow other steps. 

 
I have two tables in the database, one called AvailableGenericSteps which has a TypeCd and a ResponseCd.  The other table is called AvailableNonGenericSteps which has a TypeCd, an origincd and a responsecd.  Basically the typecd indicates the type of case it is.
 
So now I need to figure out to fill the drop down list.  At the point that I am ready to fill it, I know two things, The type of problem it is and the previous step. 
 
So in VB I did a query on the first table, AvailableGenericSteps where typecd was equal to the typecd of the case and retrieved back all the rows that qualified.  I then queried the second table, AvailableNonGenericSteps with the typecd and the previous step code.  I then retrieved back all the rows that qualified and unioned them with the query from the first table.  Using this union, I then populated my drop down box.  
 
In IdeaBlade I don't have a union, so any suggestions on how to do this using 2 entity lists.  One entityList will have the steps retrieved back the from the AvailableGenericSteps and the other entityList will have the steps retrieved back from the AvailableNonGenericSteps.  Now do I combine the two entitylists and populate the datasource of the ComboBox?
 
Here is what I have so far.
 
public void BuildStepsList()
{
      RdbQuery query1 = new Query(typeof(AvailableGenericStep));
      query1.AddClause(AvailableGenericStep.EventTypeCdEntityColumn, EntityTypeQueryOp.EQ, currentEvent.EventTypeCd);
      EntityList<AvailableGenericStep> gSteps = myPM.GetEntities<AvailableGenericStep>(query1);
 
     RdbQuery query2 = new Query(typeof(AvailableNonGenericStep));
      query2.AddClause(AvailableNonGenericStep.EventTypeCdEntityColumn, EntityTypeQueryOp.EQ, currentEvent.EventTypeCd);
      EntityList<AvailableNonGenericStep> ngSteps = myPM.GetEntities<AvailableNonGenericStep>(query2);
 
}
 
 
A thought just occured to me, can I do the following?
 
EntityList<Entity> list = new EntityList();
list.Add(nSteps);
list.Add(ngSteps);
 
but then how do I bind the binding source object to that????
 
Is this a place for a Dynamic Entity?
 
 
 
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 28-Apr-2008 at 1:55pm
Try something like this:
 
EntityList<Entity> elist = new EntityList(Entity);
 
foreach (AvailableGenericStep stepAG in gSteps) {
  elist.add(stepAG)
}
 
foreach (AvailableNonGenericStep stepANG in  ngSteps) {
  elist.add(stepANG)
}
Back to Top
TimClamp View Drop Down
Newbie
Newbie
Avatar

Joined: 08-Jul-2008
Location: Houston, TX
Posts: 4
Post Options Post Options   Quote TimClamp Quote  Post ReplyReply Direct Link To This Post Posted: 08-Jul-2008 at 1:32pm
According to the documentation for generic entitylist, it supports CopyTo.
 
 
List1.CopyTo(List2)
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down