on 01-11-2011 5:38 AM
Hello,
I am trying to set the value of the M_ERS_YEAR (an object picker of years) field of an extension collection column and field was stored in FCI_MAS_TIMEPERIOD table .
The above Collection field value should auto-populate based on a extension field M_ERS_DATE .
For Ex: If i select 11/01/2011 value for M_ERS_DATE , M_ERS_YEAR collection field should be populated with Year 2011 value .
I tried out by using Set(value) method . but on re-open the Year field appears to be blank .
can any one guide me , how to pull the Year value from time Period table and set to M_ERS_YEAR collection field using Script
Any assistance would be greatly appreciated.
Thanks!
Tayi
It's a little more complex than it seems as you have to 'find' the time period first then set the extension collection member field using a reference to that time period:
//the date stored in the extension field is returned as a sysDateIfc
SysDateIfc someDate = doc.getExtensionField("M_ERS_DATE").get();
//get a home Bean for the time period type
ValueListValueIBeanHomeIfc vlvHome = IBeanHomeLocator.lookup(session, ValueListValueIBeanHomeIfc.sHOME_NAME);
//get a bean for the year VLV
ValueListValueIBeanIfc timePeriodYearType = vlvHome.findUniqueByNameType("Year",ValueListTypeCodeIfc.nTYPE_TIME_PERIOD_TYPE);
//get the home Bean for the Time Period
TimePeriodIBeanHomeIfc timePeriodHome = IBeanHomeLocator.lookup(session, TimePeriodIBeanHomeIfc.sHOME_NAME);
//find the time period for the year in question
TimePeriodIBeanIfc timePeriod = timePeriodHome.findByDateAndType(someDate,timePeriodYearType.getLocalizedObjectReference());
//don't know what your collection name is but you have to retreive the collection then iterate through it to find the right member
extCollMember.set("M_ERS_YEAR",timePeriod.getObjectReference());
Hope this helps
Alan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alan ,
I have imported the Time bean . I hope It's not 5.1 version . any chance to check the version from Front end
RG holds only TimePeriodSubIBeanIfc interface alone ..
Thanks,
Tayi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alan ,
I have imported the Time bean . I hope It's not 5.1 version . any chance to check the version from Front end
RG holds only TimePeriodSubIBeanIfc interface alone ..
Thanks,
Deepika T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alan ,
Thank you . when i'm trying to use TimePeriodIBeanHomeIfc Interface . System throws error of TimePeriodIBeanHomeIfc not found in Name Space .
In Reference Guide I'm not able to view the TimePeriodIBeanHomeIfc Interface .. Only TimePeriodSubIBeanIfc interface is available and it has not hold sHOME_NAME ..
Please guide me
thanks,
Tayi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tayi,
What version are you using? In my 5.1 version of the Integration API, I can see both TimePeriodIBeanIfc and TimePeriodIBeanHomeIfc.
Did you place an import statement at the top of your script for these?
import com.frictionless.api.doccommon.masterdata.*;
You'll probably need to add import statements for other classes referenced in the code I posted. The full names can be found in the JAVA IAPI index from the RG.
Alan
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.