I email contractors updates and the following I want to be able to make a list of invoices. I would enter the Inv number, I would enter short text description, and finally an amount. I would like it to display the total amount at the bottom. Also, each contractor has a different number of invoices, so I would like to first say there are 3 invoices, then it will only ask me to enter 3. If I say there is only 1 invoice, then it would only ask me for one.
Hi @Jake_Strawn.
If I understand you correctly, this can definitely be done. The secret is lists. You can read about them in more detail here: Text Blaze | Formula Reference
But lemme give you a quick primer.
This is an ordered list:
{list=["item 1", "item 2", "item 3", "item 4"]}
{=list}
I can recall any item from there by its position, using this syntax:
{list=["item 1", "item 2", "item 3", "item 4"]}
{=list[1]}
I can also do a number of things to the list items, such as format them in certain ways, join them together etc.
However, what YOU are looking for are "keyed lists".
This is a keyed list:
{list=["item 1"="description 1", "item 2"="description 2", "item 3"="description 3", "item 4"="description 4"]}
{=list}
Keyed lists come in pairs—a key and a value.
If I reference the key, I get the value:
{list=["item1"="description1", "item2"="description2", "item3"="description3", "item4"="description4"]}
{=list["item1"]}
I can have lists within keyed lists too.
{list=["invoice1"=["client1", "description1", "value1"], "invoice2"=["client2", "description2", "value2"], "invoice3"=["client3", "description3", "value3"]]}
{formmenu: name=invoicenumber; values={=keys(list)}}: {=list[invoicenumber]}
If you could give me some sample data to play with I can cook up a snippet for you
I think you might be interested in something like this:
{repeat:3; locals=contracts}
Name: {formtext}
Amount: {formtext: name=cost; default=0}
{endrepeat}
Total: ${=sum(map(contracts, c -> c.cost))}
Thanks, I appreciate it. This is going to save me a ton of time. I was always jumping back and forth between excel to send out these emails.
Original Contract Amount: ${formtext: name=Original; default=0}
How many change orders? {formtext: name=number; default=0}
{repeat:number; locals=contracts}
Change Order Number: {formtext}
Description: {formtext}
Amount: {formtext: name=cost; default=0}
{endrepeat}
{TCO=sum(map(contracts, c -> c.cost))}
Total Change Orders: ${=sum(map(contracts, c -> c.cost))}
Revised contract amount: ${=TCO+Original}
Paid to date:${formtext: name=paid; default=0}
Remaining to be paid:${=TCO+Original-Paid}
Note from Admin: Edited by @Cedric_Debono_Blaze to add default values and convert into rendered snippet
@Jake_Strawn - cool stuff!
I've edited your snippet to make it rendered in the forum and also added default values in formtext commands requiring a number, so you wouldn't get that error when they're empty