Grid Selection with text array

Hi ,

 

I wanted to display some districts in grid with selection (the data of the grid is coming from a webservice call ,it has only one column and webservice returns a list of string values).

Can I directly use that String array to populate the grid data or Do I need to construct a CDT with identifiers and values in order to achieve the selection above thing.

Based on the selection values from the grid (single or batch selection) , Need to display another read only grid.

 

 

 

Thanks

soujanya

  Discussion posts and replies are publicly visible

Parents
  • You can create a paging grid without any cdt structure direct from data which you get from web service like -


    = load(
    local!MeetingNote:{"a","b","c"},
    with(
    local!datasubset:todatasubset(
    local!MeetingNote,a!pagingInfo(1,2)
    ),
    a!gridField(
    label: "Test",
    totalCount:local!datasubset.totalCount,

    columns: {
    a!gridTextColumn(
    label: "Title",
    data: {
    local!datasubset.data
    },
    alignment: "LEFT"
    )

    },
    value: a!pagingInfo(
    startIndex: 1,
    batchSize: - 1
    )
    )
    ))

    but if you want sorting on the grid than you have to create a dictionary structure or temporary cdt for this.

Reply
  • You can create a paging grid without any cdt structure direct from data which you get from web service like -


    = load(
    local!MeetingNote:{"a","b","c"},
    with(
    local!datasubset:todatasubset(
    local!MeetingNote,a!pagingInfo(1,2)
    ),
    a!gridField(
    label: "Test",
    totalCount:local!datasubset.totalCount,

    columns: {
    a!gridTextColumn(
    label: "Title",
    data: {
    local!datasubset.data
    },
    alignment: "LEFT"
    )

    },
    value: a!pagingInfo(
    startIndex: 1,
    batchSize: - 1
    )
    )
    ))

    but if you want sorting on the grid than you have to create a dictionary structure or temporary cdt for this.

Children
  • I tried to display the grid but when selecting the rows from the gird ,I am getting null value for the selected ones.
    Below is the snippet of the code.Actually I wanted to display another grid based on the first grid selected values.

    =load(
    local!availableRoleCode_txt:{"Thermal Landman","Thermal Geologist","Thermal Engineer","EOR Landman","EOR Geologist","EOR Engineer"},
    local!selectedRoleCode_txt,
    local!gridSelection: a!gridSelection(
    selected: {},
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 10
    )
    ),


    local!gridSelectable_bool:true,
    local!geologistPagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: -1
    ),
    local!engineerPagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: -1
    ),
    local!landmanPagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: -1
    ),
    a!formLayout(
    label: "Assign Users to Thermal / EOR Roles",
    instructions: "Choose AMU's within HOG district to assign engineers, geologists, and landmen to roles",
    firstColumnContents: {
    a!sectionLayout(
    label: "Choose AMU ",
    firstColumnContents: {
    with(
    local!AMUList_txt:todatasubset(
    rule!GLOB_getGISAMUsByOperatingDistrict(
    operatingDistrict_txt: "Lloydminster Heavy Oil & Gas"
    ),local!gridSelection.pagingInfo
    ), {a!dropdownField(
    label: "Roles",

    required: true(),
    value:local!selectedRoleCode_txt,
    saveInto: {
    local!selectedRoleCode_txt,
    ri!selectedRole_txt << rule!APN_returnFirstInput(
    null(),
    _
    )
    },
    choiceLabels: {
    local!availableRoleCode_txt
    },
    choiceValues: {
    local!availableRoleCode_txt
    },
    placeHolderLabel: cons!GLOB_LABEL_DROPDOWN_PLACEHOLDER,
    labelPosition: "ADJACENT"
    ),
    a!gridField(

    totalCount:local!AMUList_txt.totalCount,
    columns: {
    a!gridTextColumn(
    label:"AMU",
    data:local!AMUList_txt.data,
    alignment: "LEFT"
    )

    },
    value: local!gridSelection,
    saveInto:{a!save(ri!selectedAMUCode_txt,index(save!value, "selected", null))},
    identifiers:local!AMUList_txt.identifiers,
    selection:true()
    ), a!textField(lable:ri!selectedAMUCode_txt),if(
    rule!isTextNullOrBlank(
    ri!selectedAMUCode_txt
    ),
    {},
    with(
    local!engingeerGroup: rule!RTRR_getGroupByLocationAndType(
    location_txt: ri!selectedAMUCode_txt,
    type_txt: cons!RTRR_SUFFIX_GROUP_NAME_ENGINEER
    ),
    local!engineerGroupMemberList_user: if(
    rule!isObjectNull(
    local!engingeerGroup
    ),
    {},
    getdistinctusers(
    {
    topeople(
    local!engingeerGroup
    )
    }
    )
    ),
    local!geologistGroupMemberList_user: getdistinctusers(
    {
    topeople(
    fn!getgroupbyname(
    rule!RTRR_createGroupName(
    ri!selectedAMUCode_txt,
    cons!RTRR_SUFFIX_GROUP_NAME_GEOLOGIST
    )
    )
    )
    }
    ),
    local!landmanGroupMemberList_user: getdistinctusers(
    {
    topeople(
    fn!getgroupbyname(
    rule!RTRR_createGroupName(
    ri!selectedAMUCode_txt,
    cons!RTRR_SUFFIX_GROUP_NAME_LANDMAN
    )
    )
    )
    }
    ),
    {
    rule!RTRR_ComponentUserGrid(
    label_txt: "Current Engineer Members",
    userList_user: local!engineerGroupMemberList_user
    ),
    a!pickerFieldUsers(
    label: "Choose Engineers",
    labelPosition: "ADJACENT",
    value: ri!selectedEngineerUserList_user,
    saveInto: ri!selectedEngineerUserList_user
    ),
    a!gridField(
    label: "Geologist Members",
    totalCount: rule!lengthNullSafe(
    local!geologistGroupMemberList_user
    ),
    value: local!geologistPagingInfo,
    saveInto: local!geologistPagingInfo,
    labelPosition: "ADJACENT",
    columns: {
    a!gridTextColumn(
    label: "Users",
    data: apply(
    rule!getUserFirstNameLastName(
    _
    ),
    local!geologistGroupMemberList_user
    )
    ),
    a!gridTextColumn(
    label: "Email",
    data: apply(
    rule!GLOB_getEmailForUser(
    _
    ),
    local!geologistGroupMemberList_user
    )
    )
    }
    ),
    a!pickerFieldUsers(
    label: "Choose Geologists",
    labelPosition: "ADJACENT",
    value: ri!selectedGeologistUserList_user,
    saveInto: ri!selectedGeologistUserList_user
    ),
    a!gridField(
    label: "Landman Members",
    totalCount: rule!lengthNullSafe(
    local!landmanGroupMemberList_user
    ),
    value: local!geologistPagingInfo,
    saveInto: local!geologistPagingInfo,
    labelPosition: "ADJACENT",
    columns: {
    a!gridTextColumn(
    label: "Users",
    data: apply(
    rule!getUserFirstNameLastName(
    _
    ),
    local!landmanGroupMemberList_user
    )
    ),
    a!gridTextColumn(
    label: "Email",
    data: apply(
    rule!GLOB_getEmailForUser(
    _
    ),
    local!landmanGroupMemberList_user
    )
    )
    }
    ),
    a!pickerFieldUsers(
    label: "Choose Landman",
    labelPosition: "ADJACENT",
    value: ri!selectedLandmanUserList_user,
    saveInto: ri!selectedLandmanUserList_user
    )
    }
    )
    )}
    )
    }
    )

    }

    ,
    buttons: {
    rule!GLOB_createButtonLayoutWizard(
    continueLabel_txt: "Submit",
    buttonAction_txt: ri!buttonAction_txt
    )
    }
    )
    )
  • 0
    A Score Level 1
    in reply to Soujanya B

    Hello Soujanaya

    You have to save local!gridSelection also for save the identifier

    load(

     local!selectedAMUCode_txt,

    local!availableRoleCode_txt:{"Thermal Landman","Thermal Geologist","Thermal Engineer","EOR Landman","EOR Geologist","EOR Engineer"},

    local!gridSelection: a!gridSelection(

    selected: {},

    pagingInfo: a!pagingInfo(

    startIndex: 1,

    batchSize: 10

    )

    ),

    with(

     local!AMUList_txt:todatasubset(

    local!availableRoleCode_txt,local!gridSelection.pagingInfo

    ),

    {

     a!textField(

       value:local!AMUList_txt

     ),

    a!gridField(

    totalCount:local!AMUList_txt.totalCount,

    columns: {

    a!gridTextColumn(

    label:"AMU",

    data:local!AMUList_txt.data,

    alignment: "LEFT"

    )

    },

    value: local!gridSelection,

    saveInto:{

     local!gridSelection,

     a!save(local!selectedAMUCode_txt,index(save!value, "selected", null))},

    identifiers:local!AMUList_txt.identifiers,

    selection:true()

    )

    }

    )

    )

  • After changing it as below , its working fine now. Thanks !

    a!save(ri!selectedAMUCode_txt,index(local!AMUList_txt.data,local!gridSelection.selected,{}))