Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

Hi, I have a field Status, it's a defined list.

The list is Pending, Confirmed, Paid, Declined

The value can be any of them, BUT If the value is Pending, 60 days after the field DateReferred I want it to change to Confirmed. ALSO it can be changed to Confirmed before the 60 days has passed.

This sort of works as a Calculation, but doesn't allow for input when a record is created.

If (Status="Confirmed" ; "Confirmed" ; Case ( Status = "Paid" ; "Paid" ; Status = "Declined" ; "Declined" ; DateReferred + 60 > Get(CurrentDate) ; "Pending" ; DateReferred + 60 < Get(CurrentDate) ; "Confirmed" ))

What would be the best way to do this? To have the field auto-update.

TIA, jim

Posted

Data stored in a field will not change merely by time passing. You could either run a script periodically (e.g. on opening the file) to find these records and modify them, or add an unstored calculation field for display purposes only.

BTW, I think the calculation could be simplified to:


Case ( 

Status = "Pending" and DateReferred + 60 < Get (CurrentDate) ; "Confirmed" ; 

Status 

)

Posted

Thanks so much for that.

So I have a startup script that sets window size, etc., and as the last step I call a script that I've just created

Filemaker_ChangePendingScript.jpg

Go to Record/Request/Page [First]

Loop

If [Case ( referrals::rStatus = "Pending"  &  referrals::rDateReferred + 60 < Get (CurrentDate) ; referrals::rStatus = "Confirmed" ;  referrals::rStatus )]

End If

Go to Record/Request/Page [Next,Exit after last]

End Loop

Goes through all the files but doesn't change any.

What is the mistake I've made?

Posted (edited)

It doesn't change anything, because there's no action specified within the If[] block.

Also, it doesn't make much sense to put the entire Case() statement inside the If[] condition.

It should look something like:


...

Loop 

If [ referrals::rStatus = "Pending" and referrals::rDateReferred + 60 < Get (CurrentDate) ]

Set Field [ referrals::rStatus ; "Confirmed" ]

End If

Go to Record/Request/Page [ Next ; Exit after last ]

End Loop

...




You should also make sure that you are on the correct layout, and that your found set includes all records (or at least all records that may need changing). 

As as I said earlier, you could find these directly, instead of having to sift through the entire pile:





...

Enter Find Mode []

Set Field [ referrals::rStatus ; "Pending" ]

Set Field [ referrals::rDateReferred ; "<" & Get (CurrentDate) - 60 ]  ]

Perform Find []

...

---

P.S. Note that [color:red]& and [color:red]and are two very different things.

Edited by Guest
Posted

If [ referrals::rStatus = "Pending" and referrals::rDateReferred + 60 < Get (CurrentDate) ]

Set Field [ referrals::rStatus = "Pending" ; "Confirmed" ]

End If

Makes total sense to me, but I can't find a way to enter that in ScriptMaker.

When you add Set Field it asks for Target Field "rStatus" and then calculation.

I can't see how to get the Set Field result you've suggested.

Posted

Sorry, I wasn't careful enough with copy/paste. The target field should be referrals::rStatus, and "Confirmed" is the calculation part. I have edited my previous message accordingly.

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