Jump to content

Set field inside a button in order to pass a parameter


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

Recommended Posts

Hi,

Is there any function or any way to set a field to a value while defining the parameters for a button, like a Set field step inside a script?

Example:

I have Button1.

I have a relationship from text_field1 in TO1 to global_field1 in TO2.

text_field1 may have of course have different values based on the values of global_field1.

I assign a script to button1.

I define parameter1 as text_field1 inside the button. This is the parameter I would like to pass to the script.

I need to define several values for global_field1 and evaluate text_field1 according to this values BEFORE passing the value of text_field1 to the script.

I have everything else solved but: how do I give different values to global_field1 and then evaluate text_field1 according to this different values before passign it to the script?

I have been working on this issue for day, no luck.

Thank you

Edited by Guest
Link to comment
Share on other sites

Huh?

I'd help you but i'm just confused. My head's not following to well.

You want to pass the value of text_field1 to a script as a parameter... Okay that's about all i understand.

I need to define several values for global_field1 and evaluate text_field1 according to this values BEFORE passing the value of text_field1 to the script.

Before Passing the value of text_field1 as a parameter to the script you need to define "SEVERAL" values for "ONE" field and based on the definition of the "SEVERAL" values -- haven't really specified any test here work out what field 1 is...

how do I give different values to global_field1 and then evaluate text_field1 according to this different values before passign it to the script?

Essentially at this point I have no clue what's going where, where you're getting the several values to global_field1 from and for what purpose you are getting them there in the first place given that you are just using it to evaluate text_field1 in a particular way to then pass that value in a script -- to do what you haven't really explained... And there's global_field2 which besides a relationship to text_field1 (which hasn't been explained) doesn't really seem to play a part.

Can you give a more basic or better yet a real example? I'm not trying to say anything, it just doesn't make sense to me personally as someone on the outside... and the harder someone has to think to work out the question the less likely the answer to that question will be the answer to the question that you originally posed.

Link to comment
Share on other sites

Hi Genx,

OK, I think it might be better if I upload a sample file. Here it goes.

Take into account that this file uses 3 custom functions (not mine). I need this functions in order to get what I need and because they are great for adding clarity to the scripts. The rest is just a button passing parameters that are converted to local variables by the functions.

The problem is that I need to pass different values for the same field. This field is one side of a relationship driven by a global field whose value is the one I need to include and evaluate before passing the parameters to the script.

I hope the sample file helps you and others to understand what I am explaining here.

Thank you

parameters_sample.zip

Link to comment
Share on other sites

I need to define several values for global_field1 and evaluate text_field1 according to this values BEFORE passing the value of text_field1 to the script.

Well for that you could define a calculation based on your global and text_field1 and then pass on the result of the evaluation of text_field1 via the global as a parameter -- though i would probably do that in a script...

As for the rest, i'm still confused because while i've seen the CF before, i've never really used it...

Link to comment
Share on other sites

Thank you Genx.

I have created a new file in which I solve this issue sideways. It is not exactly what I wanted, and it has a negative side: the number of new TOs needed. On the other hand, it works fine.

I still would like to find a better, more abstract solution. Any ideas are more than welcome...

I insert my comments bellow.

Well for that you could define a calculation based on your global and text_field1 and then pass on the result of the evaluation of text_field1 via the global as a parameter

No. The problem is that the global could or could not have a value before the script is run. Even if it has a value, it could be that the value is not the one I need for the script. I can set the global to the value in my script, but because the parameters are passed by the script itself, this does not work. The script takes whatever value the global field has before running it, and it does not make any difference that I reset the value inside my script: it should be done before the script is run, which of course, it is just not possible. I am trying to find a way to do it within the button itself.

though i would probably do that in a script...

Yes, I could do that, but then in the script I need to set as many variables as different messages I would like to show. It is the way I have the script before using the custom functions, but I really like the way this functions let me pass parameters based on the script name.

As for the rest, i'm still confused because while i've seen the CF before, i've never really used it...

The CF are really wonderful (though a little complex at first sight). They simplify so much the coding and make it so simple and clear that I decided to use them rigth away. They allow you to see at a glance in the script name the parameters you are passing to the script. Besides, because they also check the parameters before converting them to local variables, while developing you have an excellent way to check your code.

The only issues I found are:

- the one I describe

- the fact that if you create a local variable within the script, but this local variable is not set by the button, you might get missguided by the script name, thinking that the only variables you have, are the ones in the script name, while there can be additional variables declared inside the script.

Link to comment
Share on other sites

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