on 10-05-2015 4:14 PM
Dear community,
I would like to query procurement price specificaiton by a productID. I tried to do this with this code:
var priceSpecQuery = ProcurementPriceSpecification.QueryByTypeCodeAndPropertyIDAndPropertyValue;
var params = priceSpecQuery.CreateSelectionParams();
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation1.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ", "TEST123");
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation1.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_PRODUCT_ID");
var result = priceSpecQuery.Execute(params);
if(result.Count() >0)
{
var resultLine = result.GetFirst();
this.PurchasingPrice = resultLine.Amount;
}
There is no result, even thought there is a price specified for the Service Product "Test123".
Can you help me with that?
Kind regards,
Christine Toblier
Hello to everyone,
I finally was able to query for price specifications. I had to use at least three property valuation query params in order to get a result.
Here is an example, that worked:
var priceSpecQuery = ProcurementPriceSpecification.QueryByTypeCodeAndPropertyIDAndPropertyValue; var params = priceSpecQuery.CreateSelectionParams(); params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation1.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_PRODUCT_ID"); params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation1.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ", "TEST-123"); params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation2.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_SUPPL_ID"); params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation2.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ", "10002"); params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation3.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_PRD_CAT_ID"); params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation3.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ", "10");
params.Add(priceSpecQuery.Status.ConsistencyStatusCode, "I", "EQ", "3"); params.Add(priceSpecQuery.Status.ReleaseStatusCode , "I", "EQ", "3");
var result = priceSpecQuery.Execute(params);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Christine ,
I tried to get the query of ProcurementPriceSpecification this with this code .
I change the PropertyValuationPriceSpecificationElementPropertyValuation [No] like the query result of repository. eg: [No] : 1 or 4 or 3...
But I can't
****************************************************************************************
var prodID = this.ProductKey.ProductID.content;
if(!prodID.IsInitial()){
var supplier = this.ToRoot.SellerParty.Party.Key.PartyID.content;
var prd_cat = this.ProductCategory.InternalID;
var priceSpecQuery =ProcurementPriceSpecification.QueryByTypeCodeAndPropertyIDAndPropertyValue;
var params = priceSpecQuery.CreateSelectionParams();
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation1.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_PRODUCT_ID");
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation1.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ", prodID);
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation2.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_SUPPL_ID");
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation2.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ", supplier);
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation3.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_PRD_CAT_ID");
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation3.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ",prd_cat);
params.Add(priceSpecQuery.Status.ConsistencyStatusCode, "I", "EQ", "3");
params.Add(priceSpecQuery.Status.ReleaseStatusCode , "I", "EQ", "3");
var result = priceSpecQuery.Execute(params);
foreach(var inst in result){
this.ToParent.ListUnitPrice.Amount.content = inst.Amount.content;
this.ToParent.ListUnitPrice.Amount.currencyCode = inst.Amount.currencyCode;
this.ToParent.ListUnitPrice.BaseQuantity.content = inst.BaseQuantity.content;
this.ToParent.ListUnitPrice.BaseQuantityTypeCode.content = inst.BaseQuantityTypeCode.content;
}
}
*******************************************************************************************************
Best Regards,
Pole
Hi Christine,
I do not know about the Query you are using, but maybe this is helpfull:
From my experience, with some queries for standard objects you have to set specific parameters to get the results.
If you leave these "required" parameters empty, the queries with this behaviour will show no content or even throw errors.
As a general hint, try to set the fields given by the name of the query, i.e. in this case try to set a type code, a property ID and a Property value to get some results. If successfull, try to reduce the parameters set to determine, which query parameters are mandatory and which not.
And: No, I do not know why some queries behave like this.
Best regards,
Ludger
--
Custom Development with All4Cloud.de
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.