cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1066
Views
0
Helpful
4
Replies

Custom Function Param Question

ryan.broersma
Level 1
Level 1

Hi,

I'm wondering if anyone knows a way to send a variable as a parameter into a custom function.

I have a CF like the following....

Name =          userTestFunction()

Parameters =  1

Function =      global.userVariable%1%_Test

In my script I want to pass in a value from a database to complete the variable name in the custom function...

userTestFunction(Database.MyDB.MyField)

Ideally I'd like the value returned from the custom function to be something like this...

global.userVariableA_Test (where 'A' is the value of 'MyField' from the DB lookup)

instead the function treats my input as a string instead of variable and returns...

global.userVariableDatabase.MyDB.MyField_Test

I'm not sure Custom Functions support passing a variable, but if anyone has figured out a way to do it, your insights would be appreciated.

Thanks,

Ryan.

4 Replies 4

What happens if your function just has %1%?  What does it return?

david

I'm not sure what you mean.  %1% is just the place-holder for the parameter w/in the custom function definition.

Yes, so does your function have a value of A or not?

david

The value of the dblookup field (Database.MyTable.MyField) is 'A', but the value of that variable isn't inserted into the %1% parameter, what's put into the parameter is 'Database.MyTable.Myfield'.  So, it treats the database lookup field as a string.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: