Jump to content
Salesforce and other SMB Solutions are coming soon. ×

A Relookup Script on Opening or current date


Tracey Webb

Recommended Posts

Here's an interesting one the guru's amongst you will surely solve.

 

I have two Related DB's. When I make changes in my Master file, some changes aren't always made in the secondary file until I perform a 'Relookup'

These files are opened and closed many times a day. For my consul operator, this can cause many a headache when printing reports if they have failed to update the browsed records.

 

I would like a script (similar to a backup script with a counter system as described in fm 5.5 help )that would - on reopening every 3 times would automatically relookup the field (in this case a field called "Phone Key". Every morning on opening the file recalculates the today date. I hoped that if this recalcultion has occurred - that the Counter field would reset to "0" (zero) so that if the file is opened three times daily then the Relookup script would run.

 

An alternative was to - on opening if the time was between eg 10:30:00am and 12:30:00pm then the Relookup script would run.

 

Any ideas??

Link to comment
Share on other sites

Hi Tracey

 

I am confused as to why you are using relookups in related files - there are reasons but I don't know what you are trying to do. I also tend to steer clear of the Today function for the reason that you have to close and open to reset it.

 

I'm sure we can help but probably need more information about what you are trying to do. Feel free to contact me personally if it is complicated.

Link to comment
Share on other sites

Tracey,

 

Can you provide some more details on what you are trying to achieve? If you want info continually up-to-date, then actually having the related field

in your reports may be a better options than having a field which uses a Lookup.

 

Also, if you use the Status(CurrentDate), instead of Today, to work out your today calc, it should always be up to date.

 

To do a lookup every third time, you would need a global number field g_OpenTimes. Then, as part of your startup script...

 

# Set the global counter if it is empty (first time the file is opened)

If(IsEmpty(g_OpenTimes))

. SetField[g_OpenTimes, "1"]

End If

# Count the number of openings, and relookup on the third

If(g_OpenTimes > 3)

. Show All Records

. Relookup[No dialog][Field]

. Setfield[g_OpenTimes,"1"]

Else

. Setfield[g_OpenTimes,g_OpenTimes + 1]

End If

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

Terms of Use