What´s the Class for new attributes created from scratch?

I am coding a groovy and I need to know what is the Class for an attribute created from scratch?
Like for standard attributes I use, for example, ATT_PAGE_TWO_TEXT50. What is the class for attributes created from scratch?

No Files Were Attached
Felipe B. Duarte Silva Agile User Asked on November 30, 2017 in Other APIs.

IYou would use either the field’s apiname, baseid or fully qulified name. These are available from the admin client.

on November 30, 2017.
Add Comment
3 Answer(s)

There will be no name like that. View the attribute in the Java Client to find the attribute id which will be a number. You can use that ID and lookup in Groovy script.

madhusudanas Agile Angel Answered on November 30, 2017.
Add Comment

Using ID it works. Thanks everyone!

Felipe B. Duarte Silva Agile User Answered on November 30, 2017.
Add Comment

Now, I have the groovy. It works for the first two blocks of get and set, but from the third one (ChpHObj) it stop working. I am suspecting the problem is because it is not string, it is numeric, but I don´t know how to fix that. Could you help me?

The error I got is: No signature of method: com.agile.api.pc.item.Item.getValueByAttId() is applicable for argument types: (java.lang.Integer) values: [2012]

The complete code is below, but for debbug I comment many lines to figure out the problem block by block.
———————
import com.agile.agileDSL.ScriptObj.IBaseScriptObj;
import com.agile.agileDSL.ScriptObj.AgileDSLException;

// add other import statements here
import com.agile.api.ItemConstants;
import com.agile.api.CommonConstants;
import com.agile.api.IRow;
import com.agile.api.IItem;
import com.agile.api.IDataObject;
import com.agile.api.ITable;
import com.agile.px.IUpdateTableEventInfo;
import com.agile.px.IEventInfo;
import com.agile.api.IAgileSession;
import com.agile.px.EventConstants;

void invokeScript(IBaseScriptObj obj) {
//script body starts here.

//loop the AI table
IAgileSession session = obj.getAgileSDKSession();
IEventInfo req = obj.getPXEventInfo();

try {
int eventType=req.getEventType();
int triggerType=req.getEventTriggerType();

//The PX is only applicable for post update event
if(eventType!=EventConstants.EVENT_UPDATE_TABLE || triggerType!=EventConstants.EVENT_TRIGGER_POST)
return;

IUpdateTableEventInfo info=(IUpdateTableEventInfo)req;
IDataObject iProd = info.getDataObject();
ITable tab = iProd.getTable(ItemConstants.TABLE_BOM);

Iterator iter = tab.iterator();

while (iter.hasNext()) {
IRow row=(IRow)iter.next();

String chItemNumber = row.getValue(ItemConstants.ATT_BOM_ITEM_NUMBER);
IItem chItem = (IItem) session.getObject(ItemConstants.CLASS_ITEM_BASE_CLASS, chItemNumber);
obj.logMonitor(chItemNumber);

Object ChNumberObj = chItem.getValue(ItemConstants.ATT_TITLE_BLOCK_NUMBER);
String ChNumber = ChNumberObj == null? “” : ChNumberObj.toString();
obj.setValueByAttId(2472272, ChNumber);
obj.logMonitor(ChNumber);

Object ChDescriptionObj = chItem.getValue(ItemConstants.ATT_TITLE_BLOCK_DESCRIPTION);
String ChDescription = ChDescriptionObj == null? “” : ChDescriptionObj.toString();
obj.setValueByAttId(2000003231, ChDescription);
obj.logMonitor(ChDescription);

// Object ChpHObj = chItem.getValueByAttId(2012);
// String ChpH = ChpHObj == null? “” : ChpHObj.toInteger();
// obj.setValueByAttId(2012, ChpH);
// obj.logMonitor(ChpH);

// Object ChOdorThresholdObj = chItem.getValue(ItemConstants.ATT_PAGE_TWO_LIST31);
// String ChOdorThreshold = ChOdorThresholdObj == null? “” : ChOdorThresholdObj.toString();
// obj.setValue(ItemConstants.ATT_PAGE_TWO_TEXT31, ChOdorThreshold);
// obj.logMonitor(ChOdorThreshold);

// Object ChApparentDensityObj = chItem.getValue(ItemConstants.ATT_PAGE_TWO_TEXT28);
// String ChApparentDensity = ChApparentDensityObj == null? “” : ChApparentDensityObj.toString();
// obj.setValue(ItemConstants.ATT_PAGE_TWO_TEXT28, ChApparentDensity);
// obj.logMonitor(ChApparentDensity);

// Object ChDensityTemperatureObj = chItem.getValue(ItemConstants.ATT_PAGE_TWO_TEXT27);
// String ChDensityTemperature = ChDensityTemperatureObj == null? “” : ChDensityTemperatureObj.toString();
// obj.setValue(ItemConstants.ATT_PAGE_TWO_TEXT27, ChDensityTemperature);
// obj.logMonitor(ChDensityTemperature);

// Object ChpHConditionObj = chItem.getValue(ItemConstants.ATT_PAGE_TWO_TEXT50);
// String ChpHCondition = ChpHConditionObj == null? “” : ChpHConditionObj.toString();
// obj.setValueByAttId(20000018783, ChpHCondition);
// obj.logMonitor(ChpHCondition);

// Object ChMeltingFreezingObj = chItem.getValueByAttId(2013);
// String ChMeltingFreezing = ChMeltingFreezingObj == null? “” : ChMeltingFreezingObj.toString();
// obj.setValueByAttId(2013, ChMeltingFreezing);
// obj.logMonitor(ChMeltingFreezing);

// Object ChFlashPointObj = chItem.getValueByAttId(2015);
// String ChFlashPoint = ChFlashPointObj == null? “” : ChFlashPointObj.toString();
// obj.setValueByAttId(2015, ChFlashPoint);
// obj.logMonitor(ChFlashPoint);

// Object ChControlledProductObj = chItem.getValueByAttId(2092);
// String ChControlledProduct = ChControlledProductObj == null? “” : ChControlledProductObj.toString();
// obj.setValueByAttId(2092, ChControlledProduct);
// obj.logMonitor(ChControlledProduct);

// Object ChNCMObj = chItem.getValue(ItemConstants.ATT_PAGE_TWO_TEXT36);
// String ChNCM = ChNCMObj == null? “” : ChNCMObj.toString();
// obj.setValue(ItemConstants.ATT_PAGE_TWO_TEXT36, ChNCM);
// obj.logMonitor(ChNCM);

// Object ChHTSCODEUSObj = chItem.getValue(ItemConstants.ATT_PAGE_TWO_TEXT43);
// String ChHTSCODEUS = ChHTSCODEUSObj == null? “” : ChHTSCODEUSObj.toString();
// obj.setValue(ItemConstants.ATT_PAGE_TWO_TEXT43, ChHTSCODEUS);
// obj.logMonitor(ChHTSCODEUS);

// Object ChCustomTariffClassMXObj = chItem.getValue(ItemConstants.ATT_PAGE_TWO_TEXT42);
// String ChCustomTariffClassMX = ChCustomTariffClassMXObj == null? “” : ChCustomTariffClassMXObj.toString();
// obj.setValue(ItemConstants.ATT_PAGE_TWO_TEXT42, ChCustomTariffClassMX);
// obj.logMonitor(ChCustomTariffClassMX);

// Object ChIPIObj = chItem.getValueByAttId(12469);
// String ChIPI = ChIPIObj == null? “” : ChIPIObj.toString();
// obj.setValueByAttId(12469, ChIPI);
// obj.logMonitor(ChIPI);

// Object ChNALADIObj = chItem.getValue(ItemConstants.ATT_PAGE_TWO_TEXT37);
// String ChNALADI = ChNALADIObj == null? “” : ChNALADIObj.toString();
// obj.setValue(ItemConstants.ATT_PAGE_TWO_TEXT37, ChNALADI);
// obj.logMonitor(ChNALADI);

// Object ChCertificationObj = chItem.getValueByAttId(2000008063);
// String ChCertification = ChCertificationObj == null? “” : ChCertificationObj.toString();
// obj.setValueByAttId(2000008063, ChCertification);
// obj.logMonitor(ChCertification);

// Object ChPhysicalStateObj = chItem.getValueByAttId(2025);
// String ChPhysicalState = ChPhysicalStateObj == null? “” : ChPhysicalStateObj.toString();
// obj.setValueByAttId(2025, ChPhysicalState);
// obj.logMonitor(ChPhysicalState);

// Object ChAppearanceObj = chItem.getValue(ItemConstants.ATT_PAGE_TWO_LIST35);
// String ChAppearance = ChAppearanceObj == null? “” : ChAppearanceObj.toString();
// obj.setValue(ItemConstants.ATT_PAGE_TWO_LIST35, ChAppearance);
// obj.logMonitor(ChAppearance);

// Object ChProductTypeObj = chItem.getValueByAttId(2023);
// String ChProductType = ChProductTypeObj == null? “” : ChProductTypeObj.toString();
// obj.setValueByAttId(2023, ChProductType);
// obj.logMonitor(ChProductType);
}

}
catch (Exception e) {
e.printStackTrace();
throw new AgileDSLException(e);
} // end of try catch block
}

Thanks in advance!

Felipe B. Duarte Silva Agile User Answered on December 1, 2017.
Add Comment

Your Answer

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