Ron Cates Posted September 29, 2009 Posted September 29, 2009 Hi All, I have records that each have several files that I am inserting into container fields. I would like to know if there is a way to use one script and have the field being imported to detirmined by a script parameter carrying the field name? Thanks
Matthew F Posted September 29, 2009 Posted September 29, 2009 (edited) I think you've stumbled on the fact that you can't use the 'Set Field By Name' script step to enter data into container fields. I'm not sure why this is, since you can use the 'Set Field' step for this purpose. Therefore I think you'll need to do it the old fashioned way... Have your script import the file into a global container. Then run a loop containing the 'Go to Next Field' and 'Exit Loop If [ Get ( ActiveFieldName ) = Get (ScriptParameter) ]'. Bracket the loop with 'Freeze Window' and 'Refresh Window' so the user doesn't have to watch the cursor jumping through the fields. Then use the 'Set Field' step specifying tempContainer as the calulated result. Edited September 29, 2009 by Guest
comment Posted September 29, 2009 Posted September 29, 2009 you can't use the 'Set Field By Name' script step to enter data into container fields. What leads to you this conclusion?
comment Posted September 30, 2009 Posted September 30, 2009 Can you clarify what exactly do you want to accomplish? First you say "insert", then you say "import" - these are NOT the same.
Ron Cates Posted September 30, 2009 Author Posted September 30, 2009 Sorry for the confusion comment. I am looking to insert a file or picture into a container field. I currently have a button set up for each field and was about to script each one seperately with goto field and inset file / picture. But then I thought it would be nice to have one script that will insert into any field according to a script parameter. I was also thinking I could specify file or picture by combining field - type in the parameter and parsing it out.
comment Posted September 30, 2009 Posted September 30, 2009 Well, if it always were a picture, you could do: If [ Get (ScriptParameter) = 1 ] Go to Field [ Table::Container 1 ] Else If [ Get (ScriptParameter) = 2 ] Go to Field [ Table::Container 2 ] Else Go to Field [ Table::Container 3 ] End If Insert Picture [] or, if you name the field objects: Go to Object [ Get (ScriptParameter) ] Insert Picture [] But I don't see how you're going to make the call between picture and file - will there be a separate button for each?
Ron Cates Posted September 30, 2009 Author Posted September 30, 2009 Thanks comment. I was able to put it together using the object idea. So here is my solution using a script parameter formated as "Object - Type". Go to Object [ Object Name: LeftWords ( Get ( ScriptParameter ) ; 1 ) ] If [ RightWords ( Get ( ScriptParameter ) ; 1 ) = "Picture" ] Insert Picture [ ] Else If [ RightWords ( Get ( ScriptParameter ) ; 1 ) = "File" ] Insert File [ ] End If It's working great! Thanks again
Matthew F Posted September 30, 2009 Posted September 30, 2009 What leads you to this conclusion. I tried it. The 'Set Field' script transfers the contents of a container item from one field to another but the 'Set Field By Name' script does not. Does it work for you?
comment Posted September 30, 2009 Posted September 30, 2009 Does it work for you? It does - does it not work for you? SetContainerByName.fp7.zip
Matthew F Posted October 1, 2009 Posted October 1, 2009 Oh, you're right. Thanks for straightening me out. I was leaving out the quote marks in the target calculation. :
Recommended Posts
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