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

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

Recommended Posts

Posted

I am trying to develop a simple chequebook file. One feature is to be the auto entry of transactions [listed as records in the autoentry table] into the account journal table. This would be thru a script that would run when you opened the file. For example, if you have a debit record for your car payment, when the script runs it sets a global to Get(CurrentDate) and if this matches the transaction date for the car payment, a record is made in the journal.

I have made a looping script to go through the auto entry records, using a global counter. This works fine.

But when I insert an external [journal table] script to make the new record inside the loop, the loop does not progress past the first record, which in my test setup equals today [actually I set all the records to today to see if this script worked]

Help please as to why this script fails

Thanks in advance

Posted

By global counter do you mean global variable or global field?

Posted (edited)

Here is the script - please note that you will see the subscript as disabled here

Go to Layout [ “auto process entries” (auto process entries) ]

Show All Records

Set Field [ auto process entries::current date global; Get ( CurrentDate ) ]

Sort Records [ Specified Sort Order: auto process entries::transaction process date; ascending ] [ Restore; No dialog ]

#sort all records, ascending by transaction date

Set Field [ auto process entries::loop counter global; 1 ]

Go to Record/Request/Page [ First ]

Loop

// Perform Script [ “new journal auto enter record” ]

#this script uses SetField to populate the new record with transaction data from the autoentries relevant [today dated] record.

Set Field [ auto process entries::loop counter global; auto process entries::loop counter global + 1 ]

Go to Record/Request/Page [ Next ]

Exit Loop If [ auto process entries::loop counter global > auto process entries::id ]

End Loop

Allow User Abort [ On ]

Set Field [ auto process entries::current date global; "" ]

#end of script step to clear globals in auto process entries table

Set Field [ auto process entries::loop counter global; "" ]

Here is the subscript:

If [ auto process entries::current date global = auto process entries::transaction process date ]

#this script uses SetField to populate the new record with transaction data from the autoentries relevant [today dated] record.

End If

Go to Layout [ “journal” (journal) ]

New Record/Request

Set Field [ journal::transaction date; Get ( CurrentDate ) ]

Set Field [ journal::transaction name; auto process entries::transaction name ]

Set Field [ journal::transaction amount; auto process entries::transaction amount ]

Exit Script [ ]

The globals are fields, not variables.

Edited by Guest
Posted

I think you're in the wrong layout [ “journal” (journal) ] when you come out of the subscript. Don't you want to be in [ “auto process entries” (auto process entries) ]?

Posted

Well that does seem to be a step forward.

Added your suggestion to my external script, which did move the loop to it's conclusion but it created new records with all with the same, first record [auto process data table records], data. Ie. in my development file I have three records to loop through as my test data. The script now creates three new records all with the same data.

Posted

I'm not sure why you'd use the test

Exit Loop If [ auto process entries::loop counter global > auto process entries::id ]

How does an ID value correspond to a counter? Wouldn't it make more sense to have

Exit Loop If [ auto process entries::loop counter global = Get (FoundCount) ]

For that matter, why don't you just specify "Exit after last record" in the Go To Record/.. [Next] dialog? Then you don't even need a counter. All you have to do is create your found set of Auto Process Entries and loop through that set. It'll greatly simplify what you want to do.

Make sense?

Posted

Thanks for replying.

I have deleted the use of the counter and implemented 'go to record next , exit after last' to move thru the autoenter records, in the loop.

Also got rid of the exit script step in my subscript.

But, no records at all are created by the subscript!

The loop works, though, and moves through all theautoenter records.

How do you get the subscript to fire repeatedly if the date condition is met?

Thanks in advance

Posted

If I understand correctly, you'd like to:

1. Find a set of records in one table on startup that indicate automatic payments due on that day.

2. Create a transaction record in a different table for each record from the found set in the first table

Is that about right?

Posted (edited)

Hello,

That is just what I wish to accomplish!

Using the data ie. date transaction name, transaction amount, etc. in the autoenter table, in the other table.

Edited by Guest
more info
Posted

This is one way to accomplish what you want to do. Now you'll just have to figure out a way to make sure that this script doesn't execute more than once a day at startup.

Also, I use a button to run the script in the example, but in real life situation you'd want to have the file execute the script automatically on startup.

Instead of looping through records, you might also consider other possible techniques for creating a batch of records. Importing records from one table to another can be a very efficient way to accomplish this too.

Hope all this helps!

Scheduled_Transactions.fp7.zip

Posted

Kent,

Thanks greatly for the file. And for persisting in offering your help.

The file does just what I wish to accomplish and has shown me several other 'new' things. Lots to learn and understand. Thanks for the import idea too which I will look into.

This topic is 6504 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.