Jump to content

FM Sorting Problems


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

Recommended Posts

  • Newbies

I have 2 databases (CustomerDB and JobDB) related to each other.

In my CustomerDB, I have a Button that when clicked, I want it to bring the JobDB window to the front, find the related records and Sort (descendingly) by JobDate. (and of course, go to a particular layout too)

The button I currently have brings the JobDB window to the front and manages to find the related records. But it does not do any sorting (that I can tell) and does not go to the correct layout. I have a script attached to the button. And the script just has 1 command to it - Go to Related Record [show, "JobDB"].

If I try to add a Sort command after it (in the scriptmaker window), it doesn't do what I want and it breaks things. I'll explain... If I add the Sort after the Go to Related Records command - the JobDB window no longer comes to the front and the CustomerDB sorts then goes to the 1st record.

Somehow I need to be able to tell the sort to sort the JobDB, not the CustomerDB. And I need to specify the correct layout.

I've also made sure that my relationship sorts by JobDate. But so far, I've yet to see how this changed anything.

Am I approaching this wrong? Do I need to create a script in the JobDB too? Or can I do everything I want within the CustomerDB?

Link to comment
Share on other sites

Not really being an expert at scripts yet, I hope my reply can help you. My understanding is that you would need to write a script in the source file to simply open the other file and then run the script that you want from the destination file. How you do this: Write the sort script in the destination file. Go back to scriptmaker in the file you are starting from and edit the script you want to do this. Select PERFORM SCRIPT from the left menu and them toggle external script. It then prompts you for a file to open - select the file that you want, then select the script that you want in the destination file. Attach this script to your button and it should all work out fine. Hope that helps...

Link to comment
Share on other sites

Try using a golobal variable in the CustomerDB file to store the current customer ID and then set up a relationship in the JobDB using a global field in both files for the matching field This allows you to link back to the CustomerDB file. That way you can access the global variable containing the customer ID. I'm not sure this is the best way of doing what you want but it might help.

Link to comment
Share on other sites

This topic is 7867 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
 Share

×
×
  • Create New...

Important Information

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