Hi all,
I have a grid to show documents from my folder KWC and i want to filter.
for example I must be able to search by name and date the documents that are in this folder.
this is my code :
a!formLayout( label: "Documentos", contents: { a!sectionLayout( contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!textField( label: "Nombre Documento", labelPosition: "ABOVE", helptooltip: "Nombre del documento a buscar", saveInto: {}, refreshAfter: "UNFOCUS", validations: {} ) } ), a!columnLayout( contents: { a!dateField( label: "Fecha de carga", labelPosition: "ABOVE", helptooltip: "Fecha en la que se subio el documento ", saveInto: {}, validations: {}, align: "CENTER" ) } ) } ), a!columnsLayout( columns: { a!columnLayout( contents: { a!gridLayout( label: "Documentos", labelPosition: "ABOVE", headerCells: { a!gridLayoutHeaderCell( label: "Documentos Cargados" ), a!gridLayoutHeaderCell( label: "Fecha de carga" ), a!gridLayoutHeaderCell( label: "Acciones" ) }, columnConfigs: { a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: 5 ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: 5 ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: 1 ) }, rows: { a!forEach( items: folder( 29305, "documentChildren" ), expression: a!gridRowLayout( contents: { a!textField( value: document( fv!item, "name" ), readOnly: true() ), a!textField( value: document( fv!item, "dateCreated" ), readOnly: true() ), a!imageField( images: a!documentImage( document: a!iconIndicator( "REMOVE" ), caption: "Eliminar", link: a!submitLink( label: "Peticion de eliminación", confirmHeader: "¡AVISO!", confirmMessage: "Estas seguro de eliminar el siguiente documento: " &chr(10) &document( fv!item, "name" )&" Creado el " &document( fv!item, "dateCreated" ), confirmButtonLabel: "CONFIRMAR", confirmButtonStyle: "DESTRUCTIVE", cancelButtonLabel: "CANCELAR", value: fv!item, saveInto: { a!deleteDocument(fv!item) } ) ) ) } ) ) }, selectionSaveInto: {}, validations: {}, shadeAlternateRows: true ) } ) } ) }, divider: "NONE", marginbelow: "NONE" ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "CONTINUAR", icon: "thumbs-up", value: cons!RCA_ACCIONES[6], saveInto: ri!acciones, submit: true, style: "PRIMARY" ) }, secondaryButtons: { a!buttonWidget( label: "REGRESAR", icon: "exclamation-circle", value: cons!RCA_ACCIONES[7], saveInto: ri!acciones, submit: true, style: "NORMAL", validate: false ) } ) )
Discussion posts and replies are publicly visible
Hi,
Create an expression and try to use this code.
This function is searching for document Ids, inside a folder, that names starting with a specific prefix and have been created before a given date i.e. Returns all the document Ids that names starts with: "Test_Doc_2020_" and creation date is before 31-02-2020. This will return a list of document Ids.
load( if( or( rule!sco_isEmpty( ri!docStartName ), rule!sco_isEmpty( ri!folder ), rule!sco_isEmpty( ri!checkDate ) ), {}, with( /* Get all the available documents from the folder */ local!availableDocuments: if( rule!sco_isEmpty( ri!folder ), {}, getdocumentinternalidsfromfolder( ri!folder, false() ) ), /* Create a list of indexes of the available documents that name starts with ri!docStartName * and the date created is <= of the ri!checkDate */ local!listOfIndexes: wherecontains( true, a!forEach( items: local!availableDocuments, expression: and( like( document( fv!item, "name" ), ri!docStartName & "*" ), document( fv!item, "dateCreated" ) < ri!checkDate ) ) ), a!forEach( items: index( local!availableDocuments, local!listOfIndexes, {} ), expression: document( fv!item, "id" ) ) ) ) )