Multi selection lookup on Form class
class CMCSysMultiselectionLookup extends SysLookupMultiSelectGrid
{
#SysOperation
private const str CollectionValueSeparator = #CollectionValueSeparator;
public static CMCSysMultiselectionLookup lookup(Query _query, container _selectField, FormStringControl _callingCtrl, FormStringControl _recIdsControl, FormStringControl _strIdsControl, str _currentStrIds, queryRun _queryRun = null)
{
// _strIdsControl.text(_currentStrIds);
// _recIdsControl.text('');
var lookupMS = new CMCSysMultiselectionLookup();
lookupMS.parmCallingControl(_callingCtrl);
lookupMS.parmCallingControlId(_recIdsControl);
lookupMS.parmCallingControlStr(_strIdsControl);
lookupMS.parmQuery(_query);
lookupMS.parmQueryRun(_queryRun);
lookupMS.parmSelectField(_selectField);
lookupMS.parmSelectedId(conNull());
lookupMS.run();
return lookupMS;
}
public container getSelectedStrings()
{
return selectedStr;
}
public SysLookupMultiSelectValues getSelectedStringsJoined()
{
return SysOperationHelper::convertMultiSelectedValueString(selectedStr);
}
public static boolean stringListContainsItem(str _stringList, str _possibleItem)
{
container items = str2con(_stringList, CollectionValueSeparator);
for (int i = 1 ; i <= conLen(items) ; i++)
{
str item = conPeek(items, i);
if (item == _possibleItem)
{
return true;
}
}
return false;
}
}
// calling lookup class in form control
[Control("String")]
class JournalName
{
/// <summary>
///
/// </summary>
public void lookup()
{
super();
Query lookupQuery = new Query();
var selectField = [tableNum(LedgerJournalName), fieldNum(LedgerJournalName, JournalName)];
QueryBuildDataSource qbds = lookupQuery.addDataSource(tableNum(LedgerJournalName));
qbds.addRange(fieldNum(LedgerJournalName,JournalType)).value(SysQuery::value(LedgerJournalType::Daily));
qbds.addSelectionField(fieldNum(LedgerJournalName, JournalName));
qbds.addSelectionField(fieldNum(LedgerJournalName, name));
qbds.addSortField(fieldNum(LedgerJournalName, JournalName));
var lookup = CMCSysMultiselectionLookup::lookup(lookupQuery, selectField, this,this,this,this.text());
// lookupTxt = lookup.getSelectedStringsJoined();
}
}
Comments
Post a Comment