Typed list- columns original table

Posts   
 
    
BexMed
User
Posts: 63
Joined: 18-Jul-2007
# Posted on: 22-Aug-2007 12:06:18   

Hello

I have a TypedList and and what I need to do is bind all the column names from the typed list to a dropdownlist and when the user selects a column name from the dropdown list another list will be populated with values related to it.

For example. I have a dropdown list which has The column names; User, Company, County (all coming from different tables in the DB)

When "User" is selected I want the second list to be populated with all the users from the user table.

I have got my first list with all the column names and I can get the column datatype from the Typedlist, but I can't work out how to do the second part, where I get all the users?

Is there a way with the TypedList to get the "originating table" of a column, so I can select all values from it?

Or am I going about this the wrong way?

Thanks

Bex

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 22-Aug-2007 12:44:03   

User, Company, County (all coming from different tables in the DB) ... When "User" is selected I want the second list to be populated with all the users from the user table.

If the fields are coming from different tables, then most probably you have done an Inner Join between those tables, which will limit the result set.

May I ask why do you need to select from the original tables, not from the TypedList.

Anyway Upon selection of a column, ytou might use a DynamicList of that one column to fetch the other dropdownList. This should be fetched from the main table, as fields in a TypedList refer to EntityFields of the original tables.

BexMed
User
Posts: 63
Joined: 18-Jul-2007
# Posted on: 22-Aug-2007 17:21:38   

Hi

I think I may have been looking at it the wrong way and I seem to have got it working now. Thanks.

I do however have another question that is slightly linked.

I now want to create a Predicate bucket based on the options the user has chosen to use against my typed list. For example where the column name = UserName and the value from the second List.

The problem I am having here is that when you create a predicate expression you need to say something like

      bucket.PredicateExpression.Add(UserFields.UserName=="namehere")

Again I don't know the table name, only the column name.

I am not clear on exactly how I would use a dynamic list and if it would work in these circumstances?

Is there a way of just saying something like,

bucket.PredicateExpression.Add(typedList.UserName=="namehere")?

Thanks

Bex

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 23-Aug-2007 11:36:01   

I now want to create a Predicate bucket based on the options the user has chosen to use against my typed list. For example where the column name = UserName and the value from the second List.

The problem I am having here is that when you create a predicate expression you need to say something like

Code: bucket.PredicateExpression.Add(UserFields.UserName=="namehere")

Again I don't know the table name, only the column name.

In your particular case, I think you should have a hardocded switch case to add a predicate based on the selected TypedList column, since you should know the TL columns beforehand (at design time).