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
Hi Mike,
in the above code, for file upload field I am checking for extension and there it is working.
But I want to disable the submit button if the file extension is other than ".xlsx".
How can I achieve that?
This isn't really possible directly via out-of-box functionality. I have an outstanding feature request that would enable this sort of thing to be done with trivially easy coding, however it's just been sitting there (i suggest you go comment / upvote / etc to help it get noticed more).
For now the best you can do is validate, as you've already done.
Ok Mike, Thanks for responding.