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

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

Recommended Posts

Posted

Hello,

When we share a filemaker project, it’s hard for non FileMaker developers to setup or import custom functions.

Because, they don’t need to know how to do this and they don’t care to learn.

So, I’m facing a problem, I have some custom function, for example Combinevalues (special thanks Jonathan Stark, author – source: http://www.briandunning.com/cf/244)

If ( ( ValueCount ( list1 ) = 0 ) or ( ValueCount ( list2 ) = 0 ) ;

"";

GetValue( list1 ; 1 ) & "=" & GetValue( list2 ; 1 ) & ¶ &

CombineValues (

RightValues ( list1 ; ValueCount ( list1 ) - 1 );

RightValues ( list2 ; ValueCount ( list2 ) - 1 )

) )

Problem: I need to transform this custom function in a script, because I can overpass the first problem (import and learning).

First try: Pick up all values in first list, and past all into a field2

• Set Variable [ $list1; Value:List(table::field) ]

• Set Variable [ $list1c; Value:ValueCount ( List ( table::field ) ) ]

• Set Field [ table::field2; GetValue ( $list1 ; 1 )&"¶" ]

• Loop

• Set Variable [ $total; Value:table::field2 ]

• Set Variable [ $counter; Value:PatternCount ( $total ; "¶" ) +1 ]

• Set Variable [ $total2; Value:$total& GetValue ( $list1 ; $counter ) ]

• Set Variable [ $list1; Value:RightValues ( $list1 ; ValueCount ( $list1 ) ) ]

• Exit Loop If [ $counter = $listc ]

• End Loop

This doesn’t work, I don’t understand why, because all seems work in theory.

After this, in need to join list2. But most be an easy way.

Now the question:

1. There is a way to transform automatically custom functions in scripts?

2. There is any plugin to import automatically custom functions, without intervention?

3. What’s the problem with my script?

Thanks,

Posted

FMA11 allows you to import CFs.

CFs, once imported, are resident in the file. Giving someone the file, gives them the CFs. They cannot edit the CFs or add new unless they have FM Advanced.

Posted

1. There is a way to transform automatically custom functions in scripts?

No.

2. There is any plugin to import automatically custom functions, without intervention?

If you have the Advanced version, you can import custom functions from the Manage Custom Functions window. Not sure what you mean by "automatically" - the import cannot be scripted.

What is the advantage in transforming the custom function into a script? If you can add a script to a file, can't you also add a custom function?

Posted

FMA11 allows you to import CFs.

CFs, once imported, are resident in the file. Giving someone the file, gives them the CFs. They cannot edit the CFs or add new unless they have FM Advanced.

I don't know if I understand well, you are telling that main file, for example: file.fp7 have already all custom functions inside, the user don’t need to import those to run the file.fp7.

Custom functions doesn’t work as plugins, isn’t necessary to install, import or do nothing, if you download my file, you will be able to run the file and the custom functions?

Correct?

Thanks for your answer

Posted

No.

If you have the Advanced version, you can import custom functions from the Manage Custom Functions window. Not sure what you mean by "automatically" - the import cannot be scripted.

What is the advantage in transforming the custom function into a script? If you can add a script to a file, can't you also add a custom function?

In my mind, scripts belong to the main file (deeply inside), because they use FileMaker internal resources (A different user in a different FileMaker can run it without set new parameters, all users have: IF, CASE, etc.). But

Custom functions are external, they use internal resources but we need to import them first to run the main file in a different Filemaker (without that custom functions).

Make sense to me ….

Posted

Custom functions are external, they use internal resources but we need to import them first to run the main file in a different Filemaker (without that custom functions).

I am afraid I don't understand the terms you are using. What is "the main file" and what is "a different Filemaker"? A custom function lives in the .fp7 file where it was defined - same as the scripts in that file. No external resources are required to USE the custom function on any system running the Filemaker application.

Posted

All FileMaker clients can use custom functions.

However, only FileMaker Advanced can create and edit custom functions.

If you still want to script that function, here is how I'd write it:

Set Variable [ $list1; List( table::field1 ) ]

Set Variable [ $list1c; ValueCount ( $list1 ) ]

Set Variable [ $list2; List( table::field2 ) ]

Loop

 Set Variable [ $counter  ; $counter + 1 ]

 Exit Loop If [ $counter > $listc ]

 Set Variable [ $combined ; GetValue( $list1 ; $counter ) & "=" & GetValue( $list2 ; $counter ) ]

 Set Variable [ $result; List( $result ; $combined ) ]

End Loop



Set Field [ table::result; $result ]

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