Getting name of a document template using dynamic provider

Hi,

I'm using Dynamic provider to get a list of documents, and i would like to get the template name in the output. I only get the template name for the "Letter" template.

Can you tell me why i'm not getting any of the other names?

I am using the following code snippet to get the data:

public static FindResults GetSoDocuments(int id)
{
    const string providerName = "Dynamic";
    const string columns = "document.document_id," +
                           "document.appointment_id.(appointment->appointment_id).task_idx.(doctmpl->doctmpl_id).name," +
                           "document.appointment_id.(appointment->appointment_id).task_idx," +

    var restrictions = $"document.appointment_id.(appointment->appointment_id).contact_id = {id}";

    using (var agent = new FindAgent())
    {
        return agent.FindFromRestrictionsColumns2(restrictions, providerName, columns, 0, 0);
    }
}

 

This is the content of doctmpl:

DocTmpl row: 1 Letter letter.docx 2
DocTmpl row: 2 Memo memo.docx 2
DocTmpl row: 3 Fax fax.docx 4
DocTmpl row: 4 Letter - Intl. intlletter.docx 2
DocTmpl row: 5 Fax - Intl. intlfax.docx 4
DocTmpl row: 6 Inc. document docinc.docx 2
DocTmpl row: 52 Quotation quote.docx 2
DocTmpl row: 53 Quote e-mail quotemail.htm 3
DocTmpl row: 54 Quote - With specified discount quotedetails.docx 2
DocTmpl row: 55 Quote - Net prices quotedetailsnetprices.docx 2
DocTmpl row: 56 Quote - Grouped with summary quotegroupeddetails.docx 2
DocTmpl row: 57 Quote - With images quotegroupeddetailsimage.docx 2
DocTmpl row: 58 Order confirmation e-mail ordermail.htm 3
DocTmpl row: 59 Order confirmation orderconfirmation.docx 2
DocTmpl row: 60 Order confirmation with VAT orderconfirmationincvat.docx 2
DocTmpl row: 103 Presentation presentation.pptx 2
DocTmpl row: 104 PDF document incpdf.pdf 2
DocTmpl row: 105 Spreadsheet spreadsheet.xlsx 2
DocTmpl row: 106 Minutes of meeting meetingminutes.docx 2
DocTmpl row: 107 Picture picture.jpg 0
DocTmpl row: 154 E-mail mail.msg 3
DocTmpl row: 155 E-mail RE: reply.msg 3
DocTmpl row: 156 E-mail FW: forward.msg 3
DocTmpl row: 157 Send doc.by E-mail maildoc.msg 3
DocTmpl row: 158 Send doc.by Fax faxdoc.msg 3
DocTmpl row: 159 Inc. E-mail mailinc.msg 3
DocTmpl row: 160 Confirmation - Contact added privacyconfirmationmail.htm 3
DocTmpl row: 161 PersonlistOld eds-us-prn-personlist.docx 2
DocTmpl row: 162 Personlist eds-us-temp-personlist(1).docx 2
DocTmpl row: 163 US:"New meeting";GE:"Neue Besprechung" invitationnew.htm 3
DocTmpl row: 164 US:"Changed meeting";GE:"Geänderte Besprechung" invitationchanged.htm 3
DocTmpl row: 165 US:"Cancelled meeting";GE:"Abgesagte Besprechung" invitationcancelled.htm 3
DocTmpl row: 166 PDF pdf document.pdf 2

Thanks in advance!

RE: Getting name of a document template using dynamic provider

"I'm using the dynamic provider"

You describe the problem in your first sentence.

The solution is to not use the dynamic provider.

Use the Document provider instead, which handles all the filtering and special cases for you.

Type - document template

 

Av: Christian Mogensen 30. dec 2020

RE: Getting name of a document template using dynamic provider

Thanks for the reply.

The reason for me to use the dynamic provider is that the Document Arcive Provider is missing the document filename, and the Dynamic Provider can give me that.

Document Archive Provider (superoffice.com)

But since i can get the doctmpl_id, i will make a second request to get the doctmpl table and make the join in the code instead.

I think that would be the best way to get the needed information.

This is the complete set of columns in my request. (I left it out in my initial question to make the focus on the doctmpl join).

const string columns = "document.document_id," +                                    "document.appointment_id.(appointment->appointment_id).registered," +
"document.appointment_id.(appointment->appointment_id).updated," +
"document.appointment_id.(appointment->appointment_id).person_id.(person->person_id).firstname," +
"document.appointment_id.(appointment->appointment_id).person_id.(person->person_id).lastname," +
"document.appointment_id.(appointment->appointment_id).task_idx.(doctmpl->doctmpl_id).name," +
"document.appointment_id.(appointment->appointment_id).task_idx," +
"document.appointment_id.(appointment->appointment_id).registered_associate_id.(associate->associate_id).person_id.(person->person_id).firstname," +
"document.appointment_id.(appointment->appointment_id).registered_associate_id.(associate->associate_id).person_id.(person->person_id).lastname," +
"document.header," +
"document.appointment_id.(appointment->appointment_id).contact_id.(contact->contact_id).name," +
"document.name";

 

Av: Michael Jensen 30. dec 2020