load( local!label, local!id, local!user, local!first, local!last, local!cdt: 'type!{http://vmrappiandevap1:7001/suite/types/}UR_listofUserandGroups'(), local!pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 10), local!pagingInfo1: a!pagingInfo(startIndex: 1, batchSize: -1), with( local!linkdata: todatasubset(local!cdt, local!pagingInfo1), local!ruleURI: getdatasubsetdownloadlinkfromrule(rule: rule!GenerateExcelRule, input: tostring(a!toJson(local!linkdata.data))), a!formLayout( label: "User Report", firstColumnContents: { a!dropdownField( label: "Application Name", required: true, requiredMessage: "Select a Application", choiceLabels: cons!GEN_APPLICATION_NAMES, choiceValues: cons!GEN_APPLICATION_ID, placeholderLabel: "--- Select Application ---", value: ri!app, saveInto: { ri!app, ri!group << rule!uinull(null,_), local!label << rule!uifirst(ri!app,_), local!id << rule!uisecond(ri!app,_), local!user << rule!uistring(_) } ), with( if(or(isnull(local!label),local!label=""),a!textField(value: "No Groups Available for this application",disabled: true),a!dropdownField( label: "Group Name", choiceLabels: sorttextarray(local!label,false), choiceValues: sorttextarray(local!label,false), placeholderLabel: "--- Select Group ---", value: ri!group, saveInto: { ri!group, local!user << rule!uithird(ri!group,_,ri!app), a!save(local!cdt.Group, save!value), a!save(local!cdt.FirstName, fn!apply(fn!user(_,"firstName"),local!user)), a!save(local!cdt.LastName, fn!apply(fn!user(_,"lastName"),local!user)), local!pagingInfo.startIndex << rule!uireturn1(1,_) } ))), with( local!filter: if(not(isnull(local!first)), index(local!user, where(search(local!first, fn!apply(fn!user(_,"firstName"),local!user)), {})), if(not(isnull(local!last)), index(local!user, where(search(local!last, fn!apply(fn!user(_,"lastName"),local!user)),{})), local!user)), local!data: todatasubset(local!filter, local!pagingInfo), if(or(isnull(local!user),local!user=""),a!textField(value: "No Members in this group",disabled: true),a!sectionLayout( label: "Search Criteria", firstColumnContents: { a!textField( label: "First Name", value: local!first, saveInto: { local!first, local!pagingInfo.startIndex << rule!uireturn1(1,_) }, refreshAfter: "KEYPRESS" ), a!textField( label: "Last Name", value: local!last, saveInto:{ local!last, local!pagingInfo.startIndex << rule!uireturn1(1,_) }, refreshAfter: "KEYPRESS" ), a!gridField( label: "List of Users", instructions: "Please click on the column headers to sort the records.", totalCount: local!data.totalCount, columns: { a!gridTextColumn( label: "First Name", data: a!applyComponents(fn!user(_,"firstName"), local!data.data, local!data.data) ), a!gridTextColumn( label: "Last Name", data: a!applyComponents(fn!user(_,"lastName"), local!data.data, local!data.data) ), a!gridTextColumn( label: "Email", data: a!applyComponents(fn!user(_,"email"), local!data.data, local!data.data) ) }, value: local!pagingInfo, saveInto: local!pagingInfo ), a!textField( label: "test", value: local!cdt ), a!textField( label: "test1", value: local!linkdata ), a!textField( label: "test2", value: local!ruleURI ) } ) )) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidgetSubmit( label: "Close", skipValidation: true, value: "close", saveInto: ri!action ) }, secondaryButtons: { a!buttonWidgetSubmit( label: "Generate Excel", style: "PRIMARY", value: "submit", saveInto: ri!action ) } ) ) ) )