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

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

Recommended Posts

Posted

Hi, I am quite new to FM - 1 month, and it seems quite difficult to find an answer to my question in this jungle :P even it might well be quite simple for you guys. So thx for you answer.

1)Is it possible to use a variable with a "go to related record" - Something like "Go to related record ($Exam)" in a script?

2)How could I turn my script to get a field content value from a related TO without using GTRR and then come back to my initial layer?

Thx

Posted

1)Is it possible to use a variable with a "go to related record" - Something like "Go to related record ($Exam)" in a script?

No. The destination table occurrence must be selected in the GTRR script step. However you could set up a switch using If statements and select the GTRR step based on a variable, but the logic would have to already be set up. (How often to new tables get added anyway?)

2)How could I turn my script to get a field content value from a related TO without using GTRR and then come back to my initial layer?

Field contents can be retrieved in several ways. If it's the first related record then just ask for the related field directly. If it's a field in the nth related record you could use the GetNthRecord() function. The GTRR step is only necessary when you want to change to the related table an select the related records.

Posted

Hi Bilbo, welcome to FM Forums!

In additional to what Vaughan said, I would add that the way to use a variable with a GTRR is to have a global field on the parent side; sometimes in addition to the standard keys with the relationship. You can then set the global with your variable results and GTRR to child data or, what you were asking in your second question, use the global to FILTER the existing relationship to pinpoint the data you want to retrieve (no need to go there using GTRR).

You can filter using the global or, since you have vs. 11, you can also filter your portal itself. But it would help to know more specific example. :wink2:

Posted

Thank you both of you for your promt and nice answers.

To make my needs a little clearer, I have made a filemaker example. I need to press on a button in the portal to import selected Rapport::Conclusion to the Consult:Report Conclusion. But I have to be back on this layout and smae record at the end of the script. The button linked script is empty now. Would you be kind enough to write a few lines of code for me? I would be extreamly grateful for that.

Thanks a lot.

Patients.zip

Posted

Thank you very much for your proposition, but unfortunately your solution is not exactly what I need, because I don't want to get all the conclusions.

In fact, I want to select only one single report record from the portal using the button and then I need to import the related conclusion (ie. Report::Conclusion) from this report to my Consultation::Report Conclusion. In other words, my Consultation::Report Conclusion field should contain only one single conclusion from a report that I have decided to select.

Could you please help me again? Thanks

Patients.zip

Posted (edited)

Version 11.0v1 on Windows XP. This is strange...

But I think I have the script, please have a look at the attached file.

But still I have a small problem:

#Script working fine

Set Variable [ $$PortalRowNumber; Value:Get ( ActivePortalRowNumber ) ]

Set Variable [ $$Conclusion; Value:GetNthRecord (Report::Conclusion; $$PortalRowNumber) ]

Set Field [ Consultation::Report Conclusion; $$Conclusion ]

Same Script, but I am using a variable ($$RelatedLayoutConclusion) instead of Report::Conclusion at the line 4 of the below script, but

now the displayed result is "Report::Conclusion". Why doesn't it work?

Set Variable [ $$PortalRowNumber; Value:Get ( ActivePortalRowNumber ) ]

Set Variable [ $$RelatedLayout; Value:GetLayoutObjectAttribute ( "Portal"; "source" ) ]

Set Variable [ $$RelatedLayoutConclusion; Value:$$RelatedLayout & "::Conclusion " ]

Set Variable [ $$Conclusion; Value:GetNthRecord ($$RelatedLayoutConclusion; $$PortalRowNumber) ]

Set Field [ Consultation::Report Conclusion; $$Conclusion ]

[color:brown]

In other words, can we use a variable as fieldName? Something like that: GetNthRecord ($$RelatedLayoutConclusion; $$PortalRowNumber)

Patients_Copy_1.zip

Edited by Guest
Posted

Sorry, I am not going there. I would concentrate on finding out why my two examples don't work for you, instead of trying something that is 10 times more complicated than it needs to be.

Posted

Don't keep creating global $$variables. These consume memory and their scope extend outside the script. Use local $variables instead, unless there is a compelling reason for the data to persist.

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