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

I wish to put a back button in my table form..


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

Recommended Posts

Posted

Hi Rushour

See attached file that has the amend as aaa suggested but I have also included 2 small scripts and a global that will allow you to navigate to any layout and back again.

All you have to do is include the name of the layout you wish to go to as a script parameter when using the go to layout script. The back button will look after itself simply tell it to perfrom the go back script. You will then be able to go anywhere and back again just by adding buttons

HTH

Phil

Oseas_Travel_updateP.zip

Posted

Hi Phil, really thanks for your help..

Sorry this is only my 3rd week playing with filemaker, after playing with it i dun understand how your go to layout work.. can you explain to me..

Thanks a lot..

Kelvin

Posted

No problem Rushhour

As you are new to this I will go through it all step by step.

First I have set up a global field called layout number. This is used to store the number of the layout that I wish to go back to (ie the layout I am coming from)

This is done in the first line of the goto layout script:

SetField Travel::layout number;Get(layout number)

If you right click the admin button in your file and go to specify button then to perform script then click on specify you will see a list of scripts that you can specify and at the bottom a field for entering an optional script parameter.

A script parameter is a piece of information that can be passed from script to script without the use of a field.

This is where you enter the name of the layout that you wish to go to.

The second line of the go to layout script is :

Go to layout [get(scriptparameter)]

This line is telling the script to go to whichever script parameter you have nominated when you set the button specification. This allows the same script to be used by different buttons to go to different places just by changing the script parameter each time.

Lastly the go back script can be used by any go back button because it goes back to the layout number stored by the first line of the go to script

HTH

Phil :

Posted

Hi Phil really thanks for your reply.

But i dun understand why are we having layoutnumber field there..?

I can just do a

Go to layout [get(scriptparameter)]

will be fine right? It can use on all the travel buttons too.

SetField Travel::layout number;Get(layout number)

Sorry i dun really understand what is the purpose of having this as its like quite not right to have that it the form..

Can explain..

Thanks a lot

Kelvin =)

Posted

Kelvin,

I think you are confusing going 'BACK' and going 'TO'

You are right you do not need the field 'layout number' but its purpose is allow you to easily integrate a 'BACK' button into your solution which is what you asked for in your first post.

If you use the go to script as it is at the moment the first line stores the number of the layout that you are leaving into the field 'Layout number'.

If you want to include a 'BACK' button anywhere in your solution all you have to do is place the button and set it to perform the go back script and no matter where you came from (assuming that you stored the layout number)that is where you will go back to. This means that you can have only one button on a layout but that button can take you to any amount of layouts depending where you came from. This is different from a button that takes you 'TO' somewhere. It only takes you 'BACK'.

After all that I have just had another look at the file I sent you and I had left the field 'layout number' bang in the middle of your first layout. You can just delete that. It does not need to be there at all. Sorry if that is all you were asking

Regards

Phil

Posted

Oh hahaha.. i think i get wad u mean..

so both the field and the text shoudn't be in the form right? it should be behind the scene??

And thanks Phil i had understand what you mean by going back and going to.

But 1 doubt still..haha..

How 'SetField Travel::layout number;Get(layout number)' actually works?? You mean each layout actually theres a number assigned that we do not know is it??

Thanks a lot Phil

Kelvin =)

Posted (edited)

Hi Kelvin,

Yes indeed there is a number attached to each layout and yes the field should work in the background only

Phil

Edited by Guest
Posted (edited)

OK Kelvin

In the script Go to Admin check you were not storing the number of the layout that you were moving from. I have added the line in the attached file

Set field layout number etc.....

HTH

Phil

oseas_update.zip

Edited by Guest
Posted

yoz phil thanks a lot..

hm.. i wish to do a previous and next button in my travel record. How actually can i make use of this layout number to do it??

Thanks phil~

Kelvin

Posted

Thanks Phil~

I got a problem. All my buttons i used your way of doing are not working. I compare how you and I did and it seems similar.. haha..

And for my sort script, i tried to do by getting script parameter so i won't have so many script but its not working.

Help... Thanks a lot~

Kelvin =)

Overseas_Travel_Request___Report.zip

Posted

Hi Kelvin

I could not get the buttons/script to work either.

I see no reason why they should not work. Strangely enough I created a new layout and that did work.

Hopefully someone more experienced than me will be able to throw some light on this - anyone???

Phil

Posted

Stranger still, I have just opened the file again to check something and now the go to layout script does not recognize the new layout that I put in. It is as if the layouts do not have recognizable numbers after the file is closed and reopened.

Phil

Posted

Your Go To Layout[] script ...

You have:

Set Field [ Travel:: LayoutNumber ; Get ( LayoutNumber) ]

Go To Layout [ layout number by calculation ... Get( ScriptParamter ) ]

Your script parameters are text. :qwery:

BTW, the problem with using LayoutNumber is that, if you ever change the layout display order the whole thing will break. Using LayoutName will work just as well ... the only thing you must protect from is changing the layout name; if you change the name you must also change your script parameters.

I have not had time to review this entire thread nor your file but I noticed one other thing ...

Your Department field in Travel is set as a Lookup of the Department field in Staff. But THAT field (Department) is what the relationship is based upon. Lookups can't also BE the key field. Your relationship to Staff should be based upon the StaffID (which is currently blank). I see no problems with your file as Phil indicated.

I hope that gets you moving forward again. :wink2:

LaRetta

Posted

Hi LaRetta im so happy to see you =)

Phil advised me to use layout number because i can do a 'back' by using that script too... ?_?

'Your Department field in Travel is set as a Lookup of the Department field in Staff. But THAT field (Department) is what the relationship is based upon. Lookups can't also BE the key field. Your relationship to Staff should be based upon the StaffID (which is currently blank). I see no problems with your file as Phil indicated. '

Yeah i actually wish to ask for guidance on this long ago.. I link it because i want when user choose the department, the hod name will automatically appear. Though i manage to get it done but i find it very weird as department definitely is not my primary key. How should i actually do with this? When then should i do a add relation and which field should i use?? And my company staff dun have a staff id..

Erm sorry as im still learning..

Thanks a lot..

Kelvin

Posted

Well, I 'Go Back' on layouts using the Layout Names which write to multiline -- maybe numbers are simpler. I will not advise either way - I simply don't KNOW the best way here. I know that using the name DOES work. My point is that you are MIXING Layout By Number with text script parameter and that is why it breaks. And I wanted to be sure you understood that moving a layout in Layout Order will break it; as will renaming a layout (if you go the text route).

You don't want to use a REAL Staff ID even if you had one - you want to create an FM ID. Just use an Auto-Enter serial. And you need a StaffID (text field) in travel (then join them on =); in which (when filling out the form), they specify who they are.

You are learning very quickly and your solution has improved from the first version. Hang in there!! :wink2:

LaRetta

Posted

Hi Laretta and Phil, thanks so much =)

i have manage to get it done, is 'gotolayout(get(scriptparameter))', then the script parameter i put the layout order number.

Then those buttons that i need to use the 'gotolayout' script i wrote, under the script parameters i manually indicate the layout order number?? Is this the best way??

question about layoutnumber: i created this field in my travel table only, but how come from my summary table i still can use this method to call for layout? (Layout number is working but just wish to figure it out =D )

'You don't want to use a REAL Staff ID even if you had one - you want to create an FM ID. Just use an Auto-Enter serial. And you need a StaffID (text field) in travel (then join them on =); in which (when filling out the form), they specify who they are.'

hm... is it only when a table need to call for a field from the other table then we link it? else we can just dont link it even they are having some of the same field?

Thanks so much~

Kelvin =)

Posted

Hi Kelvin,

Glad to hear you're rolling again.

question about layoutnumber: i created this field in my travel table only, but how come from my summary table i still can use this method to call for layout?

A layout name/number is a layout name/number to FM 7/8. It doesn't matter which table occurrence it's based upon - it all resides within the same file. Your summary table is still based upon Travel remember, but even if it were based upon Staff, FM will track it for you.

is it only when a table need to call for a field from the other table then we link it?

Yep. That's why it's called a relationship. You only relate table occurrences when you want to share data.

... else we can just dont link it even they are having some of the same field?

If you relate them, you don't need to DUPLICATE data. You can simply DISPLAY the data through the relationship when needed. Example:

You create a Travel record for Bill Smith. You want Bill Smith's Position (title within the company) to appear on the Travel form but you don't want to type it again (or even look it up). You don't need to enter it AGAIN anyway because you already KNOW - it's been entered ONCE - in Bill Smith's Staff record. If Bill Smith's Travel record is related to the Staff table on Bill Smith's unique ID then the power of relational becomes clear ... you place Bill's Position field from his STAFF record directly onto the Travel form! Like magic, it displays his Position. This is the core of relational theory -- enter information only once then simply display it as needed (through the relationship).

I suggest you try it and see how easy it is. Until you understand the power of basical relational structure, you will continue to stumble. In fact, here's the basic raw idea (attached) ...

Select a staff member from the STAFFID popup in the travel record. The yellow fields are NOT from the Travel table. They exist only in the Staff table. Now picture the power of this, multiplied over and over through a complex multi-relational business solution!! Hours upon hours of redundant data-entry are eliminated! If Mary Jones gets married and changes her last name to McKelvy, change it ONLY in her staff record. It will change throughout your solution. You don't need to change her last name in Payroll, then change her last name in Sales records, then change her last name on each of her customers ... enter it once only - and change it once only.

Oh. Don't get me going ... I begin to shake with the power of relational. Learn it first, sir, and learn it well. It is the basis on which everything else revolves. :wink2:

LaRetta

Relational.zip

Posted

Hi LaRetta

You are the greatest~ Thanks so much.. I have understood what you trying to put across to me.

But for my 'sort by' script, i am not able to do a sort by getting the script parameter, therefore i have a lot of sort by scripts. Can someone look into it and guide me..

Thanks a lot..

Kelvin

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