cancel
Showing results for 
Search instead for 
Did you mean: 

Searching qualifier

Former Member
0 Kudos

Hallo together,

has anybody experiences in searching in qualifier tables?

I have a repository with a main table and a qualifier table. Now I want to get all datasets which contain a special qualifier value.

I tried to use the QualifierSearchDimension and searching on the main table but I do not get any results. Does anybody have an idea?

Thanks

Thomas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Thomas,

following code can fetch the data for qualified field

QualifiedLinkArray qla_pr_co = null;

Search search_qual = new Search(MAINTABLE);

QualifiedLinkArray qla_pr_co = null;

qla_pr_co = catalog.GetQualifiedLinks(search_qual,MAINTABLE ,MAIN TABLE QUALIFIED LINK,RECORDID OF THE MAIN RECORD);

int size_co = qla_pr_co.GetSize();

if(size_co>0)

{

for(int x=0;x<size_co;x++)

{

QualifiedLink ql_pr = qla_pr_co.GetQualifiedLinkAt(x);

A2iFields a2i_pr = ql_pr.GetQualifiers();

A2iField a2if_purchase;

try {

a2if_purchase = a2i_pr.GetAt(0);//value of qualified field..

} catch (NullPointerException e9) {

a2if_purchase = null;

e9.printStackTrace();

}catch (RuntimeException e9) {

a2if_purchase = null;

e9.printStackTrace();

}

If still it does not work u can get back to me.

Regards,

Shruti.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello togehter

thanks for helping. It looks like there is an error in the API.

Thanks

Thomas

Greg_Austin
Active Participant
0 Kudos

That should be the way to go. Make sure your search and the result set are both pointing to the main table.


Search search = new Search(MainTableId);
//the main table field is the qualified lookup field pointing the the qualified table
QualifierSearchDimension qsd = new QualifierSearchDimension(MainTableFieldId, QualifiedTableFieldId);

TextSearchConstraint tsc = new TextSearchConstraint("test", TextSearchConstraint.EQUALS);
search.addSearchItem(qsd,tsc);

ResultDefinition rd = new ResultDefinition(MainTableId);
rd.addSelectField(MainTableFieldId);

RetrieveLimitedRecordsCommand cmd = new RetrieveLimitedRecordsCommand(connectionAccessor);
cmd.setSession(userSession);
cmd.setSearch(search);
cmd.setResultDefinition(rd);

try{
cmd.execute()
}catch(CommandException e){
}