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

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

Recommended Posts

Posted

Hello everybody,

 

I'm just starting to learn FM and this is my first question here. 

 

Thanks in advance for your attention and patience.

 

I have designed a read only layout with non editable fields so user can check the values of every field but no change the values.

 

The value of every field is a "id_customer".

 

I need to run an script by clicking on every field and I'll use the field value later in the script.

 

I'm trying to use GetFieldName ( Evaluate ( Get (ActiveFieldName ) ) ) but it doesn't work because the field is not active when I click on it...

 

Somebody can help me, please? 

 

I need the field name or the field value in order to run the script properly.

 

Thanks so much and greetings from Spain.

 

Manu

Posted

Manu - Can you please post the script; it would be easier to answer your question.

 

Jim

Posted

Ideally, you tell us what you're trying to accomplish so that we can point you in the right direction and suggest the best method.

Posted

Thanks Jim... My English is not enough good maybe...

 

The script is not ready yet but it is not important here.

 

My layout looks like a square grid with 5 x 5 fields looking like "big" boxes. The values are created in another layout saving the customer id on the first empty field (only one record in the table, 25 fields are global).

 

I need this layout behavior:

 

When an user click on a field, it should open a second layout showing the record for the id_customer stored in the clicked field.

 

Maybe you will understand me easier with this example:

 

I need to click in a non editable field and show on screen a custom dialogue box with field name or field value... This will be enough for me in order to make my script.

 

I don't want to write 25 easy scripts, I'd like to make a single dynamic script for this purpose.

 

Sorry my English...

Posted

Have you tried sending the id_Customer value stored in the clicked field as a parameter to the script?

Posted

On your Check Values (the ones the users check) set a script trigger OnObjectEnter and run this script:

 

Set Variable [$$id_Customer; Value:Get ( ActiveFieldContents )

Show Custom Dialog [Title:"Active Field Contents"; Message: "This is the active field contents " & $$id_Customer; Default Button: “OK”, Commit:“Yes”; Button 2:“Cancel”, Commit:“No”]

 

There are developers on here that are way better than me (and probably frowning reading my response), however this seems simple enough and sometimes simple is better. 

 

Good luck,

Jim

Posted

Have you tried sending the id_Customer value stored in the clicked field as a parameter to the script?

The problem is that the field can't be modified en View mode, so this field is not "active field"

(...)

 

Set Variable [$$id_Customer; Value:Get ( ActiveFieldContents )

Show Custom Dialog [Title:"Active Field Contents"; Message: "This is the active field contents " & $$id_Customer; Default Button: “OK”, Commit:“Yes”; Button 2:“Cancel”, Commit:“No”]

(...)

Thanks Jim... But there is no "active field". That's the problem. I click on a field that can't be edited in View mode...

Posted

OK I understand now - hmmm seems like this should be easy but I just tried on one of my solutions and it is not as straight forward as it seems.  

 

The reason the field is not modifiable is because the Field Entry option in the Inspector is not checked - correct?  What if you allowed Field Entry and then in the Field Options -> Prohibit Modification of Value During Data Entry?  This would allow the selected field to become the Active Field and users would not be able to modify the data.  This would prohibit you from changing the data as well - so this may not be the best option

 

The other scenario I was thinking of would be to have your Users login as a Guest or make and Account with Read-Only privileged.  This way they could click on the field to make it active however they would not be able to modify any data.  Obviously you would have full access to modify/change data.

 

I'm learning something new here today as well - keep me posted to your progress.

 

Jim

Posted

I keep trying to picture what you're doing...but Jeremy's suggestion of using a scriptparameter is probably the technique that you need. The idea is to feed a script the parameter and let the script be modular. So, each "box" is a button that runs the same script. However, each button passes a different parameter to the script. Then, you retrieve the parameter in the script using Get (ScriptParameter).

Posted

(...)

 

The reason the field is not modifiable is because the Field Entry option in the Inspector is not checked - correct?  What if you allowed Field Entry and then in the Field Options -> Prohibit Modification of Value During Data Entry?  This would allow the selected field to become the Active Field and users would not be able to modify the data.  This would prohibit you from changing the data as well - so this may not be the best option(...)

 

 

You are right, Field Entry option is not checked in the Inspector. And your suggestion about "Field Options -> Prohibit Modification of Value During Data Entry" is perfect.

 

It didn't work the first time, because I was using "Button Setup" in order to trigger the script. Then, I set the OnObjectEnter event as trigger and yes!!!

 

Thanks a lot, Jim. You showed me the right way...

 

I keep trying to picture what you're doing...but Jeremy's suggestion of using a scriptparameter is probably the technique that you need. The idea is to feed a script the parameter and let the script be modular. So, each "box" is a button that runs the same script. However, each button passes a different parameter to the script. Then, you retrieve the parameter in the script using Get (ScriptParameter).

 

An this is the second part for a perfect solution. I can see the field value in my custom dialogue so now I will delete the custom dialogue sentence and I'll write the real script using  Get (ScriptParameter) just as you suggest.

 

Thanks bcooney... The real thing is that I have learned a lot from you both. 

Posted

The problem is that the field can't be modified en View mode, so this field is not "active field"

 

So don't use Get ( ActiveFieldName ) to determine the script parameter! Use GetFieldName ( Table::hardcodedFieldReference ), and change which field is referenced for the script parameter by each button — It may not be what you were hoping, but the goal of sending them to the same script is still satisfied.

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