The Grid data doesnt refresh until change focus in other place

Hi everyone,

I´ve a problema refreshing a grid in an interface.

I cannt get the grid updated when uploading a new file, until the interface doesnt load some data (using the drop box for example), I cannt see the new file listing. Is it possible to refresh the grid automatically once the file has been uploaded? After push the "CARGAR" button, using triggers (no idea how this is..) or something like this.

Thanks for your help, and for your time of course!

Best regards!

  Discussion posts and replies are publicly visible

  • Hi ,

    Please put upload code inside with(). Please share code snippet if possible.

    Thanks,/
    Dipak
  • Hi!
    The grid area is in with() function, but inside load(). If I change external load() for with(), the process ends and returns to the main interface (the grid interface is part of a much larger application). Thanks for answer so quickly!

    The code is:

    load(

    local!filter:{
    documentType: null,
    name: null,
    documentSubtype: null
    },
    {
    with(
    local!paginacion: a!pagingInfo(
    startIndex: 1,
    batchSize: 5,
    sort: a!sortInfo(
    field: "idDoc",
    ascending: false()
    )
    ),

    local!documentos: a!queryEntity(
    entity: cons!OBE_CT_Document,
    query: a!query(
    logicalExpression: a!queryLogicalExpression(
    operator: "AND",
    filters: {
    a!queryFilter(
    field: "idCase",
    operator: "=",
    value: ri!idCase
    ),
    if(isnull(local!filter.documentType),
    {},
    a!queryFilter(
    field: "documentType",
    operator: "includes",
    value: local!filter.documentType
    )
    ),
    if(isnull(local!filter.name),
    {},
    a!queryFilter(
    field: "name",
    operator: "includes",
    value: local!filter.name
    )
    ),
    if(isnull(local!filter.documentSubtype),
    {},
    a!queryFilter(
    field: "documentSubtype",
    operator: "includes",
    value: local!filter.documentSubtype
    )
    )
    }
    ),
    pagingInfo: local!paginacion
    )
    ),

    a!sectionLayout(
    contents: {
    a!boxLayout(
    label: "On Boarding Documents",
    contents: {
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item: a!textField(
    label: "",
    labelPosition: "COLLAPSED",
    placeholder: "-- Name to search --",
    value: local!filter.name,
    saveInto: {local!filter.name},
    refreshAfter: "KEYPRESS",
    validations: {}
    )
    ),
    a!sideBySideItem(
    item: a!textField(
    label: "",
    labelPosition: "COLLAPSED",
    placeholder: "-- Document type to search --",
    value: {local!filter.documentType},
    saveInto: {local!filter.documentType},
    refreshAfter: "KEYPRESS",
    validations: {}
    )
    ),
    a!sideBySideItem(
    item: a!textField(
    label: "",
    labelPosition: "COLLAPSED",
    placeholder: "-- SubDocument type to search --",
    value: local!filter.documentSubtype,
    saveInto: {local!filter.documentSubtype},
    refreshAfter: "KEYPRESS",
    validations: {}
    )
    ),
    a!sideBySideItem(
    item: a!richTextDisplayField(
    label: "",
    labelPosition: "COLLAPSED",
    helptooltip: "",
    value: {
    a!richTextIcon(
    icon: "trash-o",
    caption: "Clean search filters",
    link: a!dynamicLink(
    label: "Dynamic Link",
    saveInto: {a!save(local!filter,null)}
    ),
    size: "LARGE"
    )
    }
    ),
    width: "MINIMIZE"
    )
    },
    alignvertical: "MIDDLE",
    spacing: "STANDARD"
    ),
    a!gridField(
    label: "Paging Grid",
    labelPosition: "COLLAPSED",
    totalCount: local!documentos.totalcount,
    columns: {
    a!gridTextColumn(
    label: "Type",
    data: {index(local!documentos.data,"documentType",{})}
    ),
    a!gridTextColumn(
    label: "Subtype",
    data: {index(local!documentos.data,"documentSubtype",{})}
    ),
    a!gridTextColumn(
    label: "Name",
    data: {index(local!documentos.data,"name",{})}
    ),
    a!gridTextColumn(
    label: "User",
    data: {index(local!documentos.data,"user",{})}
    ),
    a!gridTextColumn(
    label: "Creation Date",
    data: {index(local!documentos.data,"creationDate",{})}
    )
    },
    value: local!paginacion,
    saveInto: {local!paginacion},
    requireselection: false,
    validations: {},
    shadeAlternateRows: true,
    spacing: "DENSE",
    borderstyle: "STANDARD"
    ),
    a!richTextDisplayField(
    label: "",
    labelPosition: "ABOVE",
    value: {
    a!richTextItem(
    text: {
    "New Document File"
    },
    color: "STANDARD",
    style: {
    "STRONG"
    }
    )
    }
    ),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item: a!dropdownField(
    label: "Document Type:",
    labelPosition: "ADJACENT",
    placeholderLabel: "--- Select a Value ---",
    choiceLabels: {rule!OBE_ER_getValorCombos("documentTypes",null).descripcion},
    choiceValues: {rule!OBE_ER_getValorCombos("documentTypes",null).descripcion},
    value: ri!documentosAdjuntos.documentType,
    saveInto: {ri!documentosAdjuntos.documentType},
    required: true,
    validations: {}
    )
    ),
    a!sideBySideItem(
    item: a!dropdownField(
    label: "Document Subtype:",
    labelPosition: "ADJACENT",
    placeholderLabel: "--- Select a Value ---",
    choiceLabels: {rule!OBE_ER_getValorCombos("documentSubTypes",null).descripcion},
    choiceValues: {rule!OBE_ER_getValorCombos("documentSubTypes",null).descripcion},
    value: ri!documentosAdjuntos.documentSubtype,
    saveInto: {ri!documentosAdjuntos.documentSubtype},
    required: true,
    validations: {}
    )
    ),
    a!sideBySideItem(
    item: a!fileUploadField(
    label: "",
    labelPosition: "COLLAPSED",
    target: cons!OBE_CONS_DocumentosKC,
    fileNames: fv!file.name,
    maxselections: 1,
    value: ri!documentosAdjuntos.idDocument,
    saveInto: {ri!documentosAdjuntos.idDocument},
    validations: {},
    buttonstyle: "PRIMARY",
    buttonsize: "SMALL"
    )
    )
    },
    alignvertical: "MIDDLE"
    ),
    a!richTextDisplayField(
    label: "",
    labelPosition: "ABOVE",
    value: {
    a!richTextItem(
    text: {
    "
    "
    },
    color: "STANDARD",
    style: {
    "STRONG"
    }
    )
    }
    ),
    a!buttonArrayLayout(
    buttons: {
    a!buttonWidgetSubmit(
    label: "ADD DOCUMENT",
    saveInto: {a!save(ri!documentosAdjuntos.user,loggedInUser()),
    a!save(ri!documentosAdjuntos.idCase,ri!idCase),
    a!save(ri!documentosAdjuntos.creationDate,now()),
    a!save(ri!estado,"upload"),
    a!startProcess(
    processModel: cons!OBE_CT_DocumentOnBoarding,
    processParameters:{
    documentOnBoarding: ri!documentosAdjuntos,
    estado: "upload"
    }
    ),
    a!save(ri!documentosAdjuntos,null)
    },
    style: "NORMAL",
    validationGroup: "submit"
    /*submit: true*/
    )
    },
    align: "END"
    )
    },
    style: "ACCENT"
    )
    }
    )
    )
    }
    )


    Thank you so much for your time!!
  • Check with() vs load(). If it is with() the page refreshes while it only loads once with load().

    OR
    If you are using load, you can use the file upload as a rule input, then you can call an a!save() after every upload.

    This way, the rule input can be used to display the grid properly.
  • Hi,

    Im using load(), a try to change it, but with with() function the interface doesnt work. The functional idea is upload the grid just by pressing the button. I share code with only the grid and button section:


    load(
    local!paginacion: a!pagingInfo(
    startIndex: 1,
    batchSize: 5,
    sort: a!sortInfo(
    field: "idDoc",
    ascending: false()
    )
    ...),
    {
    with(
    local!documentos: a!queryEntity(
    ),
    a!sectionLayout(
    contents: {
    ...),
    a!gridField(
    label: "Paging Grid",
    labelPosition: "COLLAPSED",
    totalCount: local!documentos.totalcount,
    columns: {
    a!gridTextColumn(
    label: "Type",
    data: {index(local!documentos.data,"documentType",{})}
    ),
    a!gridTextColumn(
    label: "Subtype",
    data: {index(local!documentos.data,"documentSubtype",{})}
    ),
    a!gridTextColumn(
    label: "Name",
    data: {index(local!documentos.data,"name",{})},
    links: a!forEach(
    items: local!documentos.data,
    expression: a!documentDownloadLink(
    document: index(local!documentos.data,"idDocument",{})
    )
    )
    ),
    a!gridTextColumn(
    label: "User",
    data: {index(local!documentos.data,"user",{})}
    ),
    a!gridTextColumn(
    label: "Creation Date",
    data: {index(local!documentos.data,"creationDate",{})}
    )
    },
    value: local!paginacion,
    saveInto: {local!paginacion},
    requireselection: false,
    validations: {},
    shadeAlternateRows: true,
    spacing: "DENSE",
    borderstyle: "STANDARD"
    ...),

    a!buttonArrayLayout(
    buttons: {
    a!buttonWidgetSubmit(
    label: "ADD DOCUMENT",
    saveInto: {
    a!save(ri!documentosAdjuntos.user,loggedInUser()),
    a!save(ri!documentosAdjuntos.idCase,ri!idCase),
    a!save(ri!documentosAdjuntos.creationDate,now()),
    a!save(ri!estado,"upload"),
    a!startProcess(
    processModel: cons!OBE_CT_DocumentOnBoarding,
    processParameters:{
    documentOnBoarding: ri!documentosAdjuntos,
    estado: "upload"
    }
    ),
    a!save(ri!documentosAdjuntos,null)
    },
    style: "NORMAL",
    validationGroup: "submit"
    /*submit: true*/
    )
    },
  • 0
    Certified Lead Developer
    I don't believe your upload will work correctly, the way you have it set up currently. You're currently saving the value of the uploaded document into the "idDocument" property of the ri!documentosAdjuntos CDT, but in order for Appian to process the upload correctly, I believe it still requires that the main saveInto of the Document be targetted at a Document-type rule input which maps to a document-type ACP variable in the user input task.

    As far as I can tell, the way you should be doing this is by having a completely separate ri! variable to store the value of the uploaded document, then after form sumission, grab the ID of the uploaded document (since it isn't necessarily finalized until this point), store it into the "idDocument" field of your CDT at that point, and then start the "Document Onboarding" model as a subprocess before looping the user back into the SAIL form again. At that point, if you've set up everything else correctly, the grid should automatically show the current values you're expecting to see.
  • Once we upload the document, it must be submitted using PRIMARY button. Then only document get saved in the target folder. As per the screenshot, you are using SECONDARY button title ADD DOCUMENT. Also enable activity chaining in the process model
  • 0
    Certified Lead Developer
    in reply to Dude
    FYI the style of the button makes no difference to the document upload process; primary/secondary/etc affect only the button styling. All the uploaded document needs is for the form to be submitted (any submitting button click, or even submit link would do).