Announcements
No record found.
public void lookup() { super(); OMUserRoleOrganization omOrg; boolean hasOrgAccess = false; // Check if the current user has any organization access records select firstonly RecId from omOrg where omOrg.User == curUserId(); hasOrgAccess = (omOrg.RecId != 0); Query query = new Query(); QueryBuildDataSource qbdsCompany = query.addDataSource(tablenum(CompanyInfo)); qbdsCompany.addSelectionField(fieldNum(CompanyInfo, DataArea)); qbdsCompany.addSelectionField(fieldNum(CompanyInfo, Name)); if (hasOrgAccess) { QueryBuildDataSource qbdsOrg = qbdsCompany.addDataSource(tablenum(OMUserRoleOrganization)); qbdsOrg.relations(false); qbdsOrg.joinMode(JoinMode::InnerJoin); qbdsOrg.addLink( fieldnum(OMUserRoleOrganization, omInternalOrganization), fieldnum(CompanyInfo, RecId)); qbdsOrg.addRange(fieldnum(OMUserRoleOrganization, User)).value(queryValue(curUserId())); } msLookupCtrl = SysLookupMultiSelectCtrl::constructWithQuery(this.formRun(), this, query); msLookupCtrl.set(msLookupCtrl.getSelectedFieldValues()); } } [Control("Button")] class OKButton { /// <summary> /// /// </summary> public void clicked() { container selectedContainer = msLookupCtrl.getSelectedFieldValues(); // container of strings // Step 2: Convert container to List<string> selectedCompanies = new List(Types::String); for (int i = 1; i <= conLen(selectedContainer); i++) { selectedCompanies.addEnd(conPeek(selectedContainer, i)); } if (!selectedCompanies || selectedCompanies.empty()) { info("Please select at least one company using the lookup."); return; } ListEnumerator enumerator = selectedCompanies.getEnumerator(); str selectedDataAreas = ""; boolean isFirst = true; while (enumerator.moveNext()) { str currentDataArea = strLTrim(strRTrim(enumerator.current())); if (!isFirst) { selectedDataAreas += ", "; } selectedDataAreas += currentDataArea; isFirst = false; } Args args = new Args(); args.name(formStr(EmployeeInfoActiveWithDetailsConsolidated)); args.parm(selectedDataAreas); // e.g., "USMF, USRT" new MenuFunction(menuitemDisplayStr(EmployeeInfoActiveWithDetailsConsolidated), MenuItemType::Display).run(args); super(); } }
/// <summary> /// Extension for ISPEmployeeInfoActiveWithDetailsConsolidated form /// Applies DataAreaId filtering based on passed Args.parm() string /// </summary> [ExtensionOf(formStr(ISPEmployeeInfoActiveWithDetailsConsolidated))] final class ARISPEmployeeInfoActiveWithDetailsConsolidated_Extension { public void init() { // Call the original form's init logic if (this.args() && this.args().parm()) { str selectedDataAreas = this.args().parm(); // e.g. "USMF, USRT" container dataAreaContainer = str2con(selectedDataAreas, ","); FormDataSource employeeDS = this.dataSource(formDataSourceStr(ISPEmployeeInfoActiveWithDetailsConsolidated, ISPEmployeeInformations)); QueryBuildDataSource qbds = employeeDS.query().dataSourceTable(tablenum(ISPEmployeeInformations)); if (qbds) { qbds.clearRanges(); // Optional: clear if you want to fully control str orExpression; for (int i = 1; i <= conLen(dataAreaContainer); i++) { str dataArea = strLTrim(strRTrim(conPeek(dataAreaContainer, i))); if (dataArea) { if (orExpression) { orExpression += " || "; } orExpression += strFmt('(%1)', queryValue(dataArea)); } } if (orExpression) { qbds.addRange(fieldNum(ISPEmployeeInformations, DataAreaId)).value(orExpression); } } } next init(); } }
public void init() { next init(); str selectedDataAreas = this.args().parm(); // e.g. "USMF, USRT" QueryBuildDataSource emplInfoQbds = ISPEmployeeInformations_ds.queryBuildDataSource(); emplInfoQbds.addRange(fieldNum(ISPEmployeeInformations, DataAreaId)).value(selectedDataAreas); }
public void init() { next init(); str selectedDataAreas = this.args().parm(); // e.g. "USMF, USRT" container dataAreaContainer = str2con(selectedDataAreas, ','); QueryBuildDataSource emplInfoQbds = ISPEmployeeInformations_ds.queryBuildDataSource(); for (int i = 1; i <= conLen(dataAreaContainer); i++) { str dataArea = strLTrim(strRTrim(conPeek(dataAreaContainer, i))); emplInfoQbds.addRange(fieldNum(ISPEmployeeInformations, DataAreaId)).value(queryValue(dataArea)); } }
[ExtensionOf(formStr(ISPEmployeeInfoActiveWithDetailsConsolidated))] final class ARISPEmployeeInfoActiveWithDetailsConsolidated_Extension { public void init() { // Call the original form's init logic next init(); str selectedDataAreas = this.args().parm(); // e.g. "USMF, USRT" FormDataSource emplInfoDS = this.dataSource(formDataSourceStr(ISPEmployeeInfoActiveWithDetailsConsolidated, ISPEmployeeInformations)); QueryBuildDataSource emplInfoQbds = ISPEmployeeInformations_ds.queryBuildDataSource(); emplInfoQbds.addRange(fieldNum(ISPEmployeeInformations, DataAreaId)).value(selectedDataAreas); emplInfoDS.query().allowCrossCompany(true); } }
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Giorgio Bonacorsi 616
André Arnaud de Cal... 460 Super User 2026 Season 1
Syed Haris Shah 331 Super User 2026 Season 1