Tom Kennedy Posted September 3, 2009 Posted September 3, 2009 I have a container field that I want to set to a global variable which is an image. I would like to go to the object name of the field and set it without checking the "Specifying target field" checkbox. This works - If I set the field and check the "Specifying target field" checkbox. Example (one line of code): Set Field [TimeEntry::ContainerField; $$GlobalImage] This method works for both text fields and container fields. This does not work - I give the field an object name. Then I go to that object and set the field without checking the "Specifying target field" checkbox. Example (two lines of code): Go to Object [Object Name: "ContainerFieldObject"] Set Field [$$GlobalImage] This method gives me an error message #102 - Field is missing. This method works for text fields and not for container fields. Any ideas?
mr_vodka Posted September 3, 2009 Posted September 3, 2009 Setting field by indirection is available in FMP10.
Tom Kennedy Posted September 3, 2009 Author Posted September 3, 2009 I am using FM 10 Advanced. Can you give me the magic words?
mr_vodka Posted September 4, 2009 Posted September 4, 2009 Look into Set Field by Name [] Also you want want to read this thread. http://forum-en.filemaker.com/fm/board/message?board.id=FM-en-4&message.id=13841#M13841
Tom Kennedy Posted September 4, 2009 Author Posted September 4, 2009 "Set Field by Name" expects Text and as I have found out -" Set Field" without a target field requires text as well. The only way I know how to set a container field is with "Set Field" using a target field. Any other ideas on how to go to an object and replace the object field and not use "Set Field"?
comment Posted September 4, 2009 Posted September 4, 2009 Can you provide exact steps to reproduce this issue? I have just now tried the following script: Set Variable [ $v; Value:Table::Containerfield ] Go to Record/Request/Page [ Next ] Go to Object [ Object Name: "container" ] Set Field [ $v ] I have tested this with the source record containing both an embedded image and a referenced one - and in both cases it worked without a problem.
Søren Dyhr Posted September 4, 2009 Posted September 4, 2009 While you have made an interesting observation, which could qualify as "inconsequent" the frame around an image defined as an object isn't the same as the boundaries around a textfield interessting indeed ....however isn't this quite true: The only way I know how to set a container field is with "Set Field" using a target field. Take a look at the above shown scripting... --sd
comment Posted September 4, 2009 Posted September 4, 2009 the frame around an image defined as an object isn't the same as the boundaries around a textfield Not sure what that means. I believe that selecting a field object by Go to Field[] produces EXACTLY THE SAME SELECTION as Go to Object[] does.
Tom Kennedy Posted September 4, 2009 Author Posted September 4, 2009 You are right. I created a new file and tried similar code and it worked with an image from one container field copied to another container field. Now I will try to trace the problem down in my real file. I guess I gave up because of what I read (after I started this post) in the "Missing Manual" for Filemaker 10 on page 534: "(The current field method works only with text results; otherwise, you have to specify the field so FileMaker knows what type you have in mind.) I will report back if I find the problem. In the meantime, if anyone has some suggestion, please let me know. Thanks.
Søren Dyhr Posted September 4, 2009 Posted September 4, 2009 it worked with an image from one container field copied to another container field. Well that can only be referenced documents then, storing redunant is not fully embrased : : --sd
Tom Kennedy Posted September 8, 2009 Author Posted September 8, 2009 While I could accomplish what I sought by using your advice, it appears that my real world situation causes problems and has made me resort to naming the fields (which means more code, but it works without any mysterious things happening). What may be complicating the situation is that the container field also acts as a button and executes a script. There is at least one mysterious thing that happens with this combination of of circumstances. See my next post for details.
icanhazdatabase Posted October 2, 2009 Posted October 2, 2009 What may be complicating the situation is that the container field also acts as a button and executes a script. That's EXACTLY it actually. The object you named was the button, not the field. Therefore your script goes to the button but can not enter it as a field. To fix this, remove the button action (you will see the field object now has no name), name the field object, re-apply the button action. Cheers!
Recommended Posts
This topic is 5870 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 accountSign in
Already have an account? Sign in here.
Sign In Now