Show multiple document download links on portal form

I need to add multiple document download links on a portal form. It seems the link field can only hold one link. The pv is document array.

Any idea?

OriginalPostID-233975

  Discussion posts and replies are publicly visible

Parents
  • @shaoyongw Hi, The Link field can hold multiple forms as per my knowledge. To the best of my knowledge, there can be two approaches as follows and you can opt for any one of them:

    Approach - 1: (Link Form Component)
    1. There is an attribute of the Link field by name 'Options' which has a checkbox with the text called 'Allow multiple values'. Select this.
    2. In the URL value, build the URL list with the documents you have had. You can use rule!APN_getDocUrl and apply(rule!APN_getDocUrl,pv!myMultipleDocsPV) should generate the links for you. Assign the value to 'URL value' attribute and the value should be an array of links that exactly matches the number of documents.
    3. In the 'Title' value, give a list of the text string that matches the length of documents. For example, it can be either apply(fn!document(_,"name"),pv!myMultipleDocsPV) or repeat(fn!length(pv!myMultipleDocsPV),"Download").
    4. You may also give the alt value if needed, I guess this may act as a hover text.

    Pros:
    a. Simple to implement.
    Cons:
    a. Can't add any information other than a download link.
    b. Unappealing


    Approach - 2: (Paging Grid Form Component)

    1. Maintain a formatted CDT which consists of document metadata. For instance fields in this can be documentId,documentName,documentCreatedBy etc.
    2. Prior to hitting the Form, populate the formatted CDT (as discussed above) with the document objects(that were in PV) and a PV (of type cdt and multiple, which holds the document metadata information) should be ready by the time we hit the task in which the document links should be shown.
    Ex: apply(
    \ttype!myDocumentMetaDataFormattedCDT(
    \ tdocumentId:_,
    \ tdocumentName:_
    \ tdocumentDownloadLink:_
    \t),
    \tmerge(
    \ tpv!myMultipleDocsPV,
    \ tapply(document(pv!myMultipleDocsPV,"name"),pv!myMultipleDocsPV),
    \ tapply(fn!linktodocument(_,"Download",true),pv!myMultipleDocsPV)
    \t)
    )
    3. Provide the newly populated variable to paging grid as todatasubset(pv!listOfMyDocumentMetaDataFormattedCDT,data!pagingInfo). Add as many columns as you populate in the above step.

    Pros:
    a. Appealing
    b. Can add metadata as and when required
    c. Easy to reuse
    Cons:
    a. Time consuming


    Please do let us know if you have any follow-up questions or if the above didn't answer your question.
Reply
  • @shaoyongw Hi, The Link field can hold multiple forms as per my knowledge. To the best of my knowledge, there can be two approaches as follows and you can opt for any one of them:

    Approach - 1: (Link Form Component)
    1. There is an attribute of the Link field by name 'Options' which has a checkbox with the text called 'Allow multiple values'. Select this.
    2. In the URL value, build the URL list with the documents you have had. You can use rule!APN_getDocUrl and apply(rule!APN_getDocUrl,pv!myMultipleDocsPV) should generate the links for you. Assign the value to 'URL value' attribute and the value should be an array of links that exactly matches the number of documents.
    3. In the 'Title' value, give a list of the text string that matches the length of documents. For example, it can be either apply(fn!document(_,"name"),pv!myMultipleDocsPV) or repeat(fn!length(pv!myMultipleDocsPV),"Download").
    4. You may also give the alt value if needed, I guess this may act as a hover text.

    Pros:
    a. Simple to implement.
    Cons:
    a. Can't add any information other than a download link.
    b. Unappealing


    Approach - 2: (Paging Grid Form Component)

    1. Maintain a formatted CDT which consists of document metadata. For instance fields in this can be documentId,documentName,documentCreatedBy etc.
    2. Prior to hitting the Form, populate the formatted CDT (as discussed above) with the document objects(that were in PV) and a PV (of type cdt and multiple, which holds the document metadata information) should be ready by the time we hit the task in which the document links should be shown.
    Ex: apply(
    \ttype!myDocumentMetaDataFormattedCDT(
    \ tdocumentId:_,
    \ tdocumentName:_
    \ tdocumentDownloadLink:_
    \t),
    \tmerge(
    \ tpv!myMultipleDocsPV,
    \ tapply(document(pv!myMultipleDocsPV,"name"),pv!myMultipleDocsPV),
    \ tapply(fn!linktodocument(_,"Download",true),pv!myMultipleDocsPV)
    \t)
    )
    3. Provide the newly populated variable to paging grid as todatasubset(pv!listOfMyDocumentMetaDataFormattedCDT,data!pagingInfo). Add as many columns as you populate in the above step.

    Pros:
    a. Appealing
    b. Can add metadata as and when required
    c. Easy to reuse
    Cons:
    a. Time consuming


    Please do let us know if you have any follow-up questions or if the above didn't answer your question.
Children
No Data