Jump to content
AbsoluteVoice4u

Script step determined by current page layout ?

Recommended Posts

I'm looking to create a script and place it in a button to exist on two layouts (BACKUP and MAIN), to accomplish the following when activated from either layout:

Copy current ACCTNUMBER

If current layout is MAIN

then go to BACKUP layout and show the same ACCTNUMBER record.

else if

current layout is BACKUP

then go to MAIN layout and show the same ACCTNUMBER record.

 

....I'm sure it's a no brainer but right now I'm totally missing some small step to start the script ....help?

 

 

Edited by AbsoluteVoice4u
correction

Share this post


Link to post
Share on other sites

Why don't you define a relationship between the two tables (assuming the two layouts are showing records from two different tables), then use Go to Related Record[] as the button action (no common script necessary)?

Share this post


Link to post
Share on other sites

Thank you for your response and suggestion. All records are within the same table and I just need the script step to identify which button the layout is on.

Edited by AbsoluteVoice4u

Share this post


Link to post
Share on other sites
4 minutes ago, AbsoluteVoice4u said:

All records are within the same table

Are the two layouts also based on the same table occurrence? If so, all you need to do is go to the other layout. Again, no script is required: just set each button to go to the "other" layout.

Share this post


Link to post
Share on other sites

Great thinking however there are 18 layouts in this solution and yes, all based on the same table occurrence. 

I could place the layouts next to each other in the menu order and go previous and next for each button but would rather identify the present layout and have it go to the other of the two.

Any help on doing that?

Edited by AbsoluteVoice4u

Share this post


Link to post
Share on other sites

It does sound like you're over-complicating it, but maybe you want to pass Get (LayoutName) as a script parameter?

Share this post


Link to post
Share on other sites

Nowhere on the internet, including in this forum is there an example of a script showing the way to use Get (LayoutName) , with example that I can find.

If you know of a more simple way to accomplish my goal, please share it and be specific. Get (LayoutName) isn't a mandatory.

Edited by AbsoluteVoice4u

Share this post


Link to post
Share on other sites
23 hours ago, AbsoluteVoice4u said:

yes, all based on the same table occurrence.

If they are based on the same TO, then moving from one to another does not change the current record. So this entire part:

23 hours ago, AbsoluteVoice4u said:

Copy current ACCTNUMBER

If current layout is MAIN

then go to BACKUP layout and show the same ACCTNUMBER record.

else if

current layout is BACKUP

then go to MAIN layout and show the same ACCTNUMBER record.

can be reduced to just:

23 hours ago, AbsoluteVoice4u said:

If current layout is MAIN

then go to BACKUP layout

else if

current layout is BACKUP

then go to MAIN layout

which is rather trivial to translate to a script:

If [ Get ( LayoutName ) ="MAIN" ]
  Go to Layout [ “BACKUP” ]
Else If [ Get ( LayoutName ) ="BACKUP" ]
  Go to Layout [ “MAIN” ]
End If

The only problem with this approach is that if you change the name of a layout, you also have to change the string in the corresponding If/ElseIf step. There are ways around that, but they require more work - and with a just little more work you can have a dedicated button on each layout, as I suggested earlier - and as I will suggest again now:
 

23 hours ago, AbsoluteVoice4u said:

however there are 18 layouts in this solution

I am not sure what this has to do with anything. The original post discusses two layouts only. You can have as many other layouts as you like, and the two layouts in question don't need to be next to each other.  Just place a button on the MAIN layout to go to the BACKUP layout (by name), and a similar button on the BACKUP layout to go to the MAIN layout and be done.

 

Share this post


Link to post
Share on other sites

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

  • Similar Content

    • By kims
      I am working on a script that will build a document based on a value from a drop down list.
      I have a layout that contains a Document Subtype. If a certain subtype is selected from the drop down list for this record, then I want my script to be able to pull from a specific container holding the appropriate document for that type. Then I can use Doc Append to combine the two documents. Each document would be custom then to the subtype.
      I'm pretty new at FileMaker so I'm still trying to figure a lot of things out and still trying to understand how to put things together and why it will/will not work.
      I was originally using Case but then I realized that was probably not the correct thing to do. It would either append both types of documents or one, but it wasn't always the correct one.
       
      Any guidance would be greatly appreciated.
       
      If this helps, I want something that will do this:
       
      If Subtype = a, b, or c, then append Doc 1
      If subtype = d, e, or f, then append Doc 2
      and so on...
    • By Asu
      Hello FM experts, 
      this is a concept step for a more complex script but I need a script that has 2 independent features:
      1: it selects the field it is attached to as a button
      2: it can be attached to any arbitrary field and it does the same on that field.  
      The imaginary script step would be this:
      Select field [the one I am attached to] The problem I am running into is that "go to field" can not be defined by calculation, while "go to object" gets confusing between the script and the field being grouped, as the problem detailed here [https://www.soliantconsulting.com/blog/story-about-go-to-object] seems to be a complicating factor.
       
      Thanks
      Asu
    • By jcarter
      Hi Guys,
      I've been using CloudMail for a couple of years now to send marketing campaigns for my company. Just recently I have moved to remote hosting with AWS and now my server is offsite I have noticed some performance issues with cloudmail and a few other areas of my solution.
      To address these issues I have started using server-side scripts to perform labour intensive tasks such as creating bulk records (20,000) at one time. This has resulted in excellent performance once again.
      The problem I can't seem to fix is sending my email campaigns using server-side scripts. I have confirmed the plugin is installed etc on the server and with quite a bit of trial and error, I am still unable to send the campaigns.
      Does anyone have a sample script they use, or any advise how I can get this working?
      I appreciate any help and thanks in advance
      Regards,
      Jason
       
    • By naio
      My solution is build according to the 'separation model', so I would like to keep control of the local file containing the layout and presentation of the data hosted in the server.
      I wonder if I could have a script to control wether the local file gets its structure, layout or scripting modified, so I need a function to control when a change to the file has been made before giving it a version number. When the file gets open only to work with the hosted data it's not a new version.
       
    • By Oyseka
      Hi all, I have a requirement to reduce the size of a database by removing records from the work system and importing them into an offline archive system but don't know how to automate the scripting between the files.
      Database 1 is a work system where, among other things, service records are created during a service and any problems found during the service are annotated and photographed on mobile devices. At the end of the service a summary report of all actions carried out and any problems that require the customers attention is produced, signed by the customer and emailed to them.
      With about 450-600 photographs taken each month the file size will ballon very quickly so I have created a new database which is a duplicate of the photos file which contains all the required information to link to both a customer, particular service and operator and I want to find records in the work database which are over a certain number of days old, open the external file and import those records then return to the work file and delete the found set.
×

Important Information

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