CReating PricelInes

I am looking for way to create PriceLines for Price using SDK. Does any one have any code snippet which can be shared

Add Comment
2 Answer(s)

public void addPriceLines(IPrice price) throws Exception {
DateFormat df = new SimpleDateFormat(“MM/dd/yy”);
IAgileClass cls = price.getAgileClass();
ITable table = price.getTable(PriceConstants.TABLE_PRICELINES);
IAttribute attr = null;
IAgileList listvalues = null;
HashMap params = new HashMap();
//Set Ship-To Location (List field)
attr = cls.getAttribute(PriceConstants.ATT_PRICE_LINES_SHIP_TO);
listvalues = attr.getAvailableValues();
listvalues.setSelection(new Object[] { “San Jose” });
params.put(PriceConstants.ATT_PRICE_LINES_SHIP_TO, listvalues);
//Set Ship-From Location (List field)
attr = cls.getAttribute(PriceConstants.ATT_PRICE_LINES_SHIP_FROM);
listvalues = attr.getAvailableValues();
listvalues.setSelection(new Object[] { “Hong Kong” });
params.put(PriceConstants.ATT_PRICE_LINES_SHIP_FROM, listvalues);
//Set Effective From (Date field)
params.put(PriceConstants.
ATT_PRICE_LINES_PRICE_EFFECTIVE_FROM_DATE, df.parse(“10/01/03”));
//Set Effective To (Date field)
params.put(PriceConstants.ATT_PRICE_LINES_PRICE_EFFECTIVE_TO_DATE, df.parse(“10/31/03”));
//Set Quantity (Number field)
params.put(PriceConstants.ATT_PRICE_LINES_QTY, new Integer(1000));
//Set Currency Code (List field)
attr = cls.getAttribute(PriceConstants.ATT_PRICE_LINES_CURRENCY_CODE);
listvalues = attr.getAvailableValues();
listvalues.setSelection(new Object[] { “USD” });
params.put(PriceConstants.ATT_PRICE_LINES_CURRENCY_CODE, listvalues);
//Set Total Price (Money field)
params.put(PriceConstants.ATT_PRICE_LINES_TOTAL_PRICE, new Money(new Double(52.95), “USD”));
//Set Total Material Price (Money field)
params.put(PriceConstants.ATT_PRICE_LINES_TOTAL_MATERIAL_PRICE,
new Money(new Double(45.90), “USD”));
//Set Total Non-Materials Price (Money field)
params.put(PriceConstants.ATT_PRICE_LINES_TOTAL_NON_MATERIAL_PRICE,
new Money(new Double(7.05), “USD”));
//Set Lead Time (Number field)
params.put(PriceConstants.ATT_PRICE_LINES_LEAD_TIME, new Integer(5));
//Set Transportation Time (List field)
attr = cls.getAttribute(PriceConstants.ATT_PRICE_LINES_TRANSPORTATION_TIME);
listvalues = attr.getAvailableValues();
listvalues.setSelection(new Object[] { “FOB” });
params.put(PriceConstants.ATT_PRICE_LINES_TRANSPORTATION_TIME, listvalues);
//Set Country of Origin (List field)
attr = cls.getAttribute(PriceConstants.ATT_PRICE_LINES_COUNTRY_OF_ORIGIN);
listvalues = attr.getAvailableValues();
listvalues.setSelection(new Object[] { “United States” });
params.put(PriceConstants.ATT_PRICE_LINES_COUNTRY_OF_ORIGIN, listvalues);
//Create a new Price Lines row and initialize it with data
IRow row = table.createRow(params);
}

This piece of code can be found in the SDK Developer Guide 9.3.4 (Example 21-2)

Agile User Answered on February 4, 2016.
Add Comment

Thnak you so much. This helps.

Agile User Answered on February 4, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.