![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have been using this plug-in for about a year in just a single instance up to now but have a need to make fiurther use of it. The first use of it has been performing as intended, but looking at the code to refresh my memoey on how to set it up, it seems that this has been working in spite of my coding rather than because of it. In this case it is being used to change the current data input layout if the type of records being input changes. I have 5 different types of record with small differences in the fields used, each being maintained by a separate layout, but all applying records to a single data table. There is a record type field on all the layouts and the script called by Eventscript checks whether this field still matches the layout name after the entry of a new record and if necessary switches to the appropriate layout. The coding set up & functioning OK in its key respect is as follows: If (IsEmpty (organisation_type); 0 & S4HU_Eventscript (Get (FileName); "NotAllowed" ; ""); 1 & S4HU_Eventscript (Get (FileName); organisation_type ; ""); As you can probably guess my understanding of calculation formulae is somewhat lacking at the moment , all I know that the script "NotAllowed" intended to be run to prevent the record type field being blanked is never called. In deliberately blanking the field, the coding just lets it happen. Any help that anyone can offer would be appreciated |
#3
| |||
| |||
|
|
I have been using this plug-in for about a year in just a single instance up to now but have a need to make fiurther use of it. The first use of it has been performing as intended, but looking at the code to refresh my memoey on how to set it up, it seems that this has been working in spite of my coding rather than because of it. In this case it is being used to change the current data input layout if the type of records being input changes. I have 5 different types of record with small differences in the fields used, each being maintained by a separate layout, but all applying records to a single data table. There is a record type field on all the layouts and the script called by Eventscript checks whether this field still matches the layout name after the entry of a new record and if necessary switches to the appropriate layout. The coding set up & functioning OK in its key respect is as follows: If (IsEmpty (organisation_type); 0 & S4HU_Eventscript (Get (FileName); "NotAllowed" ; ""); 1 & S4HU_Eventscript (Get (FileName); organisation_type ; ""); As you can probably guess my understanding of calculation formulae is somewhat lacking at the moment , all I know that the script "NotAllowed" intended to be run to prevent the record type field being blanked is never called. In deliberately blanking the field, the coding just lets it happen. Any help that anyone can offer would be appreciated Thanks Tony If you look at the function itself (in the Specify Calculation dialog, |
#4
| |||
| |||
|
|
In article <E4GdnajhSoyjfcPbRVnyjAA (AT) bt (DOT) com TonyBowles<anthony.bowles (AT) btinternet (DOT) com> wrote: I have been using this plug-in for about a year in just a single instance up to now but have a need to make fiurther use of it. The first use of it has been performing as intended, but looking at the code to refresh my memoey on how to set it up, it seems that this has been working in spite of my coding rather than because of it. In this case it is being used to change the current data input layout if the type of records being input changes. I have 5 different types of record with small differences in the fields used, each being maintained by a separate layout, but all applying records to a single data table. There is a record type field on all the layouts and the script called by Eventscript checks whether this field still matches the layout name after the entry of a new record and if necessary switches to the appropriate layout. The coding set up & functioning OK in its key respect is as follows: If (IsEmpty (organisation_type); 0 & S4HU_Eventscript (Get (FileName); "NotAllowed" ; ""); 1 & S4HU_Eventscript (Get (FileName); organisation_type ; ""); As you can probably guess my understanding of calculation formulae is somewhat lacking at the moment , all I know that the script "NotAllowed" intended to be run to prevent the record type field being blanked is never called. In deliberately blanking the field, the coding just lets it happen. Any help that anyone can offer would be appreciated Thanks Tony If you look at the function itself (in the Specify Calculation dialog, as if you were adding it to a calc), you'll see that the syntax is S4HU_EventScript ( Get ( FileName ) ; YourScriptName;{OptionalScriptParameters} ) Thus, your calc says If organisation_type is empty make the value 0 and run the script "NotAllowed" otherwise make the value 1, but instead of a script name youhaveorganisation_type, which is the name of the field. The thing is, whenever you change the value of the field, it will then cause EventScript to run the script again no matter what. So, in the above, if organisation_type is empty, you change it to 0 (script is run), otherwise change it to 1 (script is run again). ActivateScriptDebugger and watch it happen. Alter the scheme so that a change to the field runs the script, but make the script itself do the evaluation. Put a trap at the beginning of the script to exit if the value of organisation_type is suchthatthe script should not continue. Matt |
#5
| |||
| |||
|
|
The coding set up & functioning OK in its key respect is as follows: If (IsEmpty (organisation_type); 0 & S4HU_Eventscript (Get (FileName); "NotAllowed" ; ""); 1 & S4HU_Eventscript (Get (FileName); organisation_type ; ""); As you can probably guess my understanding of calculation formulae is somewhat lacking at the moment , all I know that the script "NotAllowed" intended to be run to prevent the record type field being blanked is never called. In deliberately blanking the field, the coding just lets it happen. |
#6
| |||
| |||
|
|
Assuming this calc resides as a field validation, is there a reason you need a script called 'NotAllowed' to run? Why not just use FileMaker's built in validation to prevent blank entries? Something like: Case (IsEmpty (organisation_type); 0; 1 & S4HU_Eventscript (Get (FileName); Change_Layout_by_org_type ; ""); |
![]() |
| Thread Tools | |
| Display Modes | |
| |