Interface (disable link after changing service name dropdown)

Certified Senior Developer

a!localVariables(
  local!data:rule!VG_CRK_RT_get_all_srvc_nm(),
  local!exportDocId,
  local!errorMessage,
  local!flag:false(),
  a!formLayout(
    label: "",
    contents: {
      a!sectionLayout(
        label: "",
        contents: {
          a!radioButtonField(
            label: "Select Any Option",
            labelPosition: "ABOVE",
            instructions: "",
            helpTooltip: "Before Uploading, Download a file for service, to view latest data",
            choiceLabels: {"Download", "Upload"},
            choiceValues: {false(),true()},
            value: ri!isUpload,
            saveInto: {ri!isUpload},
            required: true,
            choiceLayout: "STACKED",
            validations: {}
          )
        }
      ),
      a!richTextDisplayField(
        labelPosition: "COLLAPSED",
        value: {
          "Before Uploading, Download a file for service, to view latest data"
        }
      ),
      a!dropdownField(
        label: "Service Name",
        labelPosition: "ABOVE",
        placeholder: "Select a Service",
        choiceLabels:local!data,
        choiceValues:local!data,
        value: ri!service_name,
        saveInto: {ri!service_name},
        searchDisplay: "ON",
        showWhen: a!isNotNullOrEmpty(ri!isUpload),
        required: true,
        validations: {}
      ),
      a!buttonArrayLayout(
        buttons: {
          a!buttonWidget(
            label: "Click to Generate url for download",
            icon: "file-download",
            tooltip: "please click on button after choosing the service name to get accurate data",
            value: true(),
            saveInto:  {a!exportDataStoreEntityToExcel(
              entity: cons!VG_CRK_RT_download_constant,
              selection: a!querySelection({
                a!queryColumn(field: "srvc_nm",alias: "Service_Name"),
                a!queryColumn(field: "pln_spnsr_id",alias: "Plan_Sponsor_Id"),
                a!queryColumn(field: "parallel_bgn_ts",alias: "Parallel_Begin_Date"),
                a!queryColumn(field: "parallel_end_ts",alias: "Parallel_End_Date"),
                a!queryColumn(field: "live_bgn_ts",alias: "Live_Begin_Date"),
                a!queryColumn(field: "live_end_ts",alias: "Live_End_Date")
              }),
              filters: a!queryFilter(
                field: "srvc_nm",
                operator: "=",
                value: ri!service_name
              ),
              documentName: ri!service_name & now(),
              saveInFolder: cons!VG_CRK_RT_File_Store,
              onSuccess: a!save(
                local!exportDocId,
                fv!newDocument
              ),
              /*This displays an error if there is an issue executing the save*/
              onError: a!save(
                local!errorMessage,
                "Error Exporting File to Excel"
              )
            ),ri!button
            },
            submit: false,
            style: "PRIMARY",
            loadingIndicator: true()
            /*showWhen: and(ri!isUpload=false(),a!isNotNullOrEmpty(ri!service_name),contains({touniformstring(rule!VG_CRK_RT_get_distnct_values_frm_clnt_srvc_table())},ri!service_name),a!isNullOrEmpty(local!exportDocId))*/,
            showWhen: ri!isUpload=false()
          )
        },
        showWhen:and(contains({touniformstring(rule!VG_CRK_RT_get_distnct_values_frm_clnt_srvc_table())},ri!service_name),a!isNotNullOrEmpty(ri!service_name)),
        align: "START"
      ),
      a!linkField(
        label: "",
        labelPosition: "ABOVE",
        links:  a!documentDownloadLink(
          label: "Download_Service_Information",
          document: local!exportDocId
        ),
        showWhen: And(
          ri!isUpload = false(),
          a!isNotNullOrEmpty(ri!service_name),
          a!isNotNullOrEmpty(local!exportDocId),
          contains(
            {
              touniformstring(
                rule!VG_CRK_RT_get_distnct_values_frm_clnt_srvc_table()
              )
            },
            ri!service_name
          )
        )
      ),
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!linkField(
                label: "Since the selected service has no data use the following sample template to upload a data for selected service",
                labelPosition: "ABOVE",
                links: {
                  a!documentDownloadLink(
                    label: "Sample_template",
                    document: cons!VG_CRK_RT_SAMPLE_TEMPLATE
                    /*showWhen: and(*/
                    /*ri!isUpload = false(),*/
                    /*a!isNotNullOrEmpty(ri!service_name),*/
                    /*not(contains({touniformstring(rule!VG_CRK_RT_get_distnct_values_frm_clnt_srvc_table())},ri!service_name)))*/
                  )
                },
                showWhen: and(
                  ri!isUpload = false(),
                  a!isNotNullOrEmpty(ri!service_name),
                  not(contains({touniformstring(rule!VG_CRK_RT_get_distnct_values_frm_clnt_srvc_table())},ri!service_name)))
              )
            },
            width: "AUTO",
            showWhen:true()
          )

        },
        alignVertical: "TOP",
        showWhen: true(),
        marginAbove: "NONE",
        marginBelow: "STANDARD",
        spacing: "STANDARD",
        stackWhen: "PHONE",
        showDividers: false()
      ),
      a!fileUploadField(
        label: "Upload File",
        labelPosition: "ABOVE",
        target:cons!VG_CRK_RT_File_Store,
        maxSelections: 1,
        value: ri!file,
        saveInto: ri!file,
        showWhen: and(ri!isUpload=true(),a!isNotNullOrEmpty(ri!service_name)),
        validations: 
        a!localVariables(
          local!invalidExtension: difference(upper(fv!files.extension), {"XLSX"}),
          if(
            length(local!invalidExtension) > 0,       
            "Only Excel files can be uploaded having Extension XLSX. Please Remove: " & 
            index(fv!files, "name", wherecontains(local!invalidExtension, upper(fv!files.extension)),{}),       
            ""

          )


        ),
        buttonSize: "STANDARD"
      )
    },
    buttons: a!buttonLayout(
      primaryButtons: {
        a!buttonWidget(
          label: "Submit",
          submit: true,
          style: "PRIMARY",
          loadingIndicator: true,
          showWhen: and(ri!isUpload=true(),a!isNotNullOrEmpty(ri!service_name),a!isNotNullOrEmpty(ri!file)),
          validate: false
          /*disabled: a!isNotNullOrEmpty(),*/
        )
      },
      secondaryButtons: {},
      showWhen: a!isNotNullOrEmpty(ri!isUpload)
    ),
    showWhen: true
  )
)
  

Hi, 

Above snap & code represents my Interface.

There is a dropdown field in it, if the user selects service name from dropdown and if that service has data present in DB then I am using button field to generate the url for downloading file.

My question is, if user selects the different service which has also some data to download from DB then I don't want to show the link to user after selecting different service Name, it should generate when user clicks on button only.(In short the link field should be disabled after selecting the service name which has data in DB). 

Is there any way to achieve this functionality?

Thanks,

Kiran

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data