Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4779 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

Hi everyone.

I'm a new member of FM Forums as I have always been able to find what I'm looking for on existing threads, but this time it's different!

I have a database that contains values which can be viewed in an invoice layout. The invoices may need to be drawn up in euros or pounds, depending on what currency I have selected in my currency field. Each invoice needs to be sent to a different email address.

I need FM to run a script every day to check whether I need to send an invoice. Invoices are sent 2 weeks before the 'balance due date'.

I am managing to isolate the correct records (ie I'm able to find those records that need to be turned into invoices), but I am not able to attach the relevant PDFs. To recap, some emails need to have attached an invoice in £ and some need the invoice in €, but I think my problem lies with the 'set variable' side of things. I've tried for hours, but I just can't get it to work!

Attached is a grab of the script. I had real problems with looping the script, so I worked around this by creating another script repeats the attached script 10 times!! With this current set up, I can get all found records (4 for example) to create the correct email, attaching the correct address, but only record number 4 has the correct invoice attached - the other 3 have no attachments.

I'm sure there's a much, much better way of scripting these steps, I just don't know what they are! If there's anyone who could help, I'd be really grateful.

Best wishes,

CatherineB

for FMForum.tiff

Posted

Have you reviewed this demo I posted a while ago? You would need to switch layouts based on your currency field.

From your script, you might possibly have an invalid path. Hard to tell.

  • Newbies
Posted

Aha!

Thank you bcooney, I had already looked at the demo but hadn't really understood before. Now I get it and happily the invoicing script works - thank you.

There is another issue and I'm not sure if I should start a new topic for this? I cannot seem to get the invoicing script to loop properly, so I work round this by having another script that repeats the invoicing script. Would you know where I need to start and finish the loop, and where to place the 'go to first record' and 'go to next, last record' script steps? I've tried loads of times, but it ends up endlessly looping so that I have to force quit in order to stop the script, or doesn't loop properly so that only one invoice is generated when there are 2 records that ought to generate invoices - I've attached it to this in the hope that you could take a look.

Thanks again for your help.

catherineb

invoicing script step.tiff

Posted

OK. You need your Go To First right after the If [Get (FoundCount) >0]. Then the loop begins, so Loop. Go to Next (Exit after Last) is right after the Set Field (BalanceDueEmailSent), then the End Loop.

btw, I typically do Set Variable [$path] rather than naming a variable "variablename".

This topic is 4779 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.