Is This possible

Posts   
 
    
Karlang
User
Posts: 6
Joined: 08-Mar-2006
# Posted on: 02-Apr-2006 07:38:30   

I have an Employee Table. On the GUI i have a Search Type (combo box) and Search Criteria (Text Box) User can do search based on Search Type for SSN,LastName, FirstName ....... so far i have been writting the IPredicateExpressionto get the SSN,LastName,FirstName search results....

Someting like this...

DataTable EmployeeResult = employee.GetMulti(filter);

but now my users want more and more search type like department, Email, PhoneNumber zipcode,city....and more

so to make this more dynamic i have created a table EmployeeSearchType that has Two Column SearchType and SPName

Something like following

SearchType , SPName LastName , spEmpBYLastName FirstName , spEmpBYFirstName SSN , spEmpBYSSN

OK here is the question

how can i get result from these SP with one line of code

something like following

DataTable EmployeeResult=myProject.StoredProcedureCallerClasses.RetrievalProcedures."Name of SP with Parameter"

is there any way to pass the SP Name to StoredProcedureCallerClasses from String with parameter?

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39798
Joined: 17-Aug-2003
# Posted on: 02-Apr-2006 11:13:53   

You can call a proc by using the proc call methods in DbUtils. simple_smile

THough you also should look into ways to build the search with predicates and relations, as that's perfectly possible.

Frans Bouma | Lead developer LLBLGen Pro
pilotboba
User
Posts: 434
Joined: 05-Aug-2005
# Posted on: 03-Apr-2006 18:01:31   

Karlang wrote:

I have an Employee Table. On the GUI i have a Search Type (combo box) and Search Criteria (Text Box) User can do search based on Search Type for SSN,LastName, FirstName ....... so far i have been writting the IPredicateExpressionto get the SSN,LastName,FirstName search results....

Why don't you provide a text box for each of these items. They fill in the ones they want, and you build the PredicateExpression by adding a predicate for each item the user put a search value into.

BOb

Walaa avatar
Walaa
Support Team
Posts: 14987
Joined: 21-Aug-2005
# Posted on: 04-Apr-2006 08:38:20   

so to make this more dynamic i have created a table EmployeeSearchType that has Two Column SearchType and SPName

Something like following

SearchType , SPName LastName , spEmpBYLastName FirstName , spEmpBYFirstName SSN , spEmpBYSSN

Is this a database table? if so: I think you don't have to, just try to use the RelationPredicateBucket and add predicate expression as you go.


RelationPredicateBucket Bucket  = new RelationPredicateBucket();
if(strLastName != string.Empty)         
    Bucket.PredicateExpression.Add(PredicateFactory.CompareValue(EmployeeFieldIndex.LastName, ComparisonOperator.Equal, strLastName));
if(strFirstName != string.Empty)
    Bucket.PredicateExpression.Add(PredicateFactory.CompareValue(EmployeeFieldIndex.FirstName, ComparisonOperator.Equal, strFirstName));
.
.

Karlang
User
Posts: 6
Joined: 08-Mar-2006
# Posted on: 04-Apr-2006 14:48:06   

Thank you all for your prompt response.