This topic contains 5 replies, has 0 voices, and was last updated by tgrimm 9 years, 2 months ago.

  • Author
    Posts
  • #2155

    acoghlan

    We use the simple projects functionality to track and invoice time against jobs.

    I’ve modified one of the sample Advanced PDF Invoice templates reasonably successfully, however am having trouble getting just the project name to appear on the PDF. The field that I’ve found is “entity” which appears in the XML structure as ${record.entity}, however in our system that looks like this: 9999 Customer Name: Project Name: SubProject Name (e.g. 8546 Microsoft Corporation: Report on Bill’s House: Supplementary Report). The number at the start is the Job number (i.e. project number) not the customer number.

    I’m trying to work out how to get just the project name – or at least remove the customer name from the text. Using the above example, I would like to see 8546 Report on Bill’s House: Supplementary Report

    I’ve seen something about joins in the field reference, but cant find any documentation on how to use them – not sure if I’m able to join the job table and get just a name? Alternatively is it possible to do some kind of substring function within the template?

    Can anyone help?

    Thanks

    Andrew
    This is a cached copy. Click here to see the original post.

  • #2156

    Nelliott

    This is not a particularly elegant way to do it but could work for you…

    a) identify the customer name ( ${record.parent} <– just a hunch you may need to use ".txt" so the id is not returned. )

    b) Replace the company name with blank:

    ${record.entity?replace(${record.parent}, "")}

    You might have to assign both sides in to variables i.e. entity?replace(company, "")


    acoghlan replied on 07/28/2015, 05:40 PM: Thanks Nelliott – out of interest is there a syntax guide somewhere? i.e. where did you come up with the syntax for the replace statement?

  • #2157

    Nelliott

    Apologies for the late reply, I managed to get locked out of my account and had trouble sorting out the password

    I normally navigate to : http://freemarker.org/docs/index.html

  • #2158

    tgrimm

    Originally posted by acoghlan

    View Post

    We use the simple projects functionality to track and invoice time against jobs.

    I’ve modified one of the sample Advanced PDF Invoice templates reasonably successfully, however am having trouble getting just the project name to appear on the PDF. The field that I’ve found is “entity” which appears in the XML structure as ${record.entity}, however in our system that looks like this: 9999 Customer Name: Project Name: SubProject Name (e.g. 8546 Microsoft Corporation: Report on Bill’s House: Supplementary Report). The number at the start is the Job number (i.e. project number) not the customer number.

    I’m trying to work out how to get just the project name – or at least remove the customer name from the text. Using the above example, I would like to see 8546 Report on Bill’s House: Supplementary Report

    I’ve seen something about joins in the field reference, but cant find any documentation on how to use them – not sure if I’m able to join the job table and get just a name? Alternatively is it possible to do some kind of substring function within the template?

    Can anyone help?

    Thanks

    Andrew

    Its been a while since you posted this question, has it been worked out yet? If not shoot me a message and i can show you how to accomplish what you are looking for.

  • #2159

    Nelliott

    Don’t be shy, post the solution for others to see and future reference!

  • #2160

    tgrimm

    Generally you can use the data tree hierarchy to get the information you are looking for. So if you want just the company name for instance instead of the name/ID you would use the following syntax: ${record.entity.companyname} Record – Current record you are working with. Entity – The bill to, customer, vendor, etc. Then companyname is pretty self explanatory. You are basically giving the route to take to get the data you want. Find the record im working on,then to to the entity from this record, then give me the company name of the entity. This works with almost all documents or records tied to each other.

You must be logged in to reply to this topic.