No replies
648 Posts

Pinned topic Issue with WQL while handling multi occuring attribute searches

‏2012-08-23T10:18:53Z |

I am having issue while searching for a multi occuring attribute, where I am getting resultset from both the occurrences instead of providing search in a particular occurrence.

Below is the scenario:

Item (Primary Spec/12NC): KIU65

Item Secondary Enrichment Spec Data:

(Enrichment Spec/Target System to Publish#0/Select Target System).pk = 1
(Enrichment Spec/Target System to Publish#0/UpSell Relationship/it_IT).pk = 1001
(Enrichment Spec/Target System to Publish#0/UpSell Relationship/it_IT) = Italy Catalog

(Enrichment Spec/Target System to Publish#1/Select Target System).pk = 201
(Enrichment Spec/Target System to Publish#1/UpSell Relationship/it_IT).pk = 1205
(Enrichment Spec/Target System to Publish#1/UpSell Relationship/it_IT) = Italy Catalog
Now the query is running to retrieve the UpSell Relationship data for the "Target System to Publish" occurrence where "Select Target System" pk is equal to 201.

So result should be 1205 & Italy Catalog.

The query is as below:

var sPK = "KIU65";
var sLocale_Code = "it_IT";
var sTargetSystemPK = "201";
var sEnrichmentSpec = "Enrichment_Attributes_Country_Sec_Spec";
var sCatalogName = "Italy Product Catalog";
var sPrmySpec = "Product Catalog Primary Spec";

//Now get the corresponding 12NC Codes and the Other Details for all 12NC Codes

// Query is attached in the attachment
var actSecondquery = new SearchQuery(sSecQuery);
var actSecsrsResults = actSecondquery.execute();
if(actSecsrsResults.size() > 0)
while (
var sUpsellPMKey = checkString(actSecsrsResults.getString(1),"");
var sUpsellRelCtgName = checkString(actSecsrsResults.getString(2),"");
var sTPK = checkString(actSecsrsResults.getString(3),"");

if(sUpsellPMKey != "")
out.writeln(sUpsellPMKey + "::" + sUpsellRelCtgName + "::" + sTPK);

Resultset is:

1001::Italy Product Catalog::201
1205::Italy Product Catalog::201

Howeever as per the expected scenario, the resultset should be only for the second occurrence (As given below) as for Second Occurrence the Select Target System is 201.

1205::Italy Product Catalog::201

Is there any issue with the query to handle only those corresponding occurrences in the attributes present in the select clause of the query.

Thanks in advance,