El_Pablo Posted October 13, 2006 Posted October 13, 2006 Hi, What could be a script that would loop through container in a layout? As a VB programmer I would think of something like this, but I can't find the same functions under ScriptMaker. Go to Field [First] // First doesn't exist Loop If [isContainer(ActiveField)] // What is the equivalent in ScriptMaker? Set Variable [$filePath; Value: "filewin:c:/temp/" & Photos::PhotoID * 2 & ".jpg"] // I hope I'm ok! Export Field Contents [ActiveField; $filePath] End If Exit Loop If [No more field] // What is the equivalent in ScriptMaker? End Loop Any help would be appreciated Thank you
Inky Phil Posted October 13, 2006 Posted October 13, 2006 This is something like the structure that you want Go to record (first) Loop If not isempty (container field) do whatever you want endif Go to record next(exit after last) endloop HTH Phil
El_Pablo Posted October 13, 2006 Author Posted October 13, 2006 Hmmm... Not exactly. I want to loop in the same record, but in all the container fields that this record contains. Go to Field (First) Loop If Field is container Export to file end if Go to Next Field Exit if No more field End Loop
Inky Phil Posted October 13, 2006 Posted October 13, 2006 Ah, sorry I misunderstood what you wanted - and now I am embarrased to say that I do not know how you do what you want . Hopefully someone else will step in and help Phil
ThatOneGuy Posted October 13, 2006 Posted October 13, 2006 Hi Nick: ... then it's not a "loop" in the traditional sense you need; rather, your script will need to "visit" or check each of a given record's fields. Think in terms of a series of "If" statements, testing whether each container field is populated, then exporting its contents. You may then indeed want a loop to advance to the next record. Only you know for sure. And just an aside, the "Go to Next Field" step is dependent on the Tab Order you've set for your layout. It can lead to some unexpected results.
El_Pablo Posted October 13, 2006 Author Posted October 13, 2006 Ok, I though it was possible to loop through all the fields and check if a field is a container. Is there a function that verify the field type? by example: Get (ActiveFieldType) With such function I could do Go to Field [Table::ItemID] Set Variable [$fieldName; Get (ActiveFieldName)] Loop If (PatternCount(Get (ActiveFieldType); "Container") > 0) // I can still work around, but it is ugly coding [my instructions here] End If Go to Next Field Set Variable [$fieldName; Get (ActiveFieldName)] Exit Loop If [$fieldName = "ItemID"] End Loop Thank you
Lee Smith Posted October 13, 2006 Posted October 13, 2006 I noticed that you mention VB in your first post, are you trying to access the database fields externally using VB? Lee
El_Pablo Posted October 13, 2006 Author Posted October 13, 2006 Ohh Sorry, No, it is just that I'm used to program in VB style with Access and I feel a bit helpless with FM programming style.
Lee Smith Posted October 13, 2006 Posted October 13, 2006 (edited) Okay, then I'm a little dense as to the purpose of your script. It seems to me that you would already know what fields are type Container, so what is it that you want the script to do. You p.s., tell me in English, don't try to script it. Edited October 13, 2006 by Guest p.s.
El_Pablo Posted October 13, 2006 Author Posted October 13, 2006 Actually, I'm working on a DB that is 12 years old. That was growing since then and also it wasn't normalised! (BTW: I'm not the creator of this monster 1800+ fields). There's a bunch of pictures on a table and I want to export these images to a web site through FTP. The layout I'm working on contains at least 25 containers. 1. The first step is to export these containers to a temp folder on the local computer. This is where I am now 2. Upload these new files to ftp account. 3. Reference all the containers to the file on the web, since the database is accessible externally with FMS8. 4. Delete the content of the temp folder. I bought these plugins MediaManager and FTPit. So as you can see, I have a h ell of a job to do in the next couple of days. And after this part done, I will create a whole new DB.
Lee Smith Posted October 13, 2006 Posted October 13, 2006 Actually, I'm working on a DB that is 12 years old. That was growing since then and also it wasn't normalised! (BTW: I'm not the creator of this monster 1800+ fields). There's a bunch of pictures on a table and I want to export these images to a web site through FTP. The layout I'm working on contains at least 25 containers. 1. The first step is to export these containers to a temp folder on the local computer. This is where I am now 2. Upload these new files to ftp account. 3. Reference all the containers to the file on the web, since the database is accessible externally with FMS8. 4. Delete the content of the temp folder. I bought these plugins MediaManager and FTPit. So as you can see, I have a h ell of a job to do in the next couple of days. And after this part done, I will create a whole new DB. You have put your version as 8.5, have you converted these files to 8.5? You have to have a plugin for version earlier then v7 (this maybe 8) to export the contents of a container field. In version 8, there has been some very helpful discussions on exporting contents of a container field by [color:blue]comment, starting. Here This is about the limit of my knowledge on your questions, others will need to jump in about how to make it work using Server, Web, etc. Lee
El_Pablo Posted October 13, 2006 Author Posted October 13, 2006 The DB has already been exported to FMP8 before I started with this company. I just arrived to this company a few weeks ago. For now I'm only patching to make their things work, before I redo the new DB. Thanx
BobWeaver Posted October 14, 2006 Posted October 14, 2006 Look at the design functions. You can use them to get information about the field type. So you could have this in your script: if[MiddleWords(FieldType ( Get ( FileName ) ; Get ( ActiveFieldName ) );2;1)="Container"] ...whatever... End If
Recommended Posts
This topic is 6617 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