pctechtv Posted November 8, 2013 Posted November 8, 2013 Does anybody have an example of a Script using a field of values and looping through it? I had found the FileMaker article here http://help.filemaker.com/app/answers/detail/a_id/2403 and added the good advice, that this is not currently the best way to do this, and other advice to not use copy and paste (a better way is to set variables and retrieve them was the advice of many knowledgeable people). In this article it show a way to use a loop to run through the records in a portal, and send the useful data to another field. It works but does not seem to be that efficient. One thing that makes me wonder about it, is this is the only script that show and hour glass in my solution. So what if you had the list of values in field and wanted to check if some condition was true or anything else on the values. If these values are in a field how can you loop through and perform condition checks and such. I have already determined that you have to use ValueCount() instead of Count to count them, I was sitting 15 minutes wondering why Count was always 1. Pic shows type of result I am referring to. http://pctechtv.com/show/listscript.png
comment Posted November 8, 2013 Posted November 8, 2013 So what if you had the list of values in field and wanted to check if some condition was true or anything else on the values. Not sure what exactly would you want to do as a result of the check. In general, the loop could go something like this: Loop Set Variable [$i ; $i + 1] Exit Loop If [$i > ValueCount ( YourTable::YourField )] If [GetValue ( YourTable::YourField ; $i ) > 100] # do something here End If End Loop
pctechtv Posted November 8, 2013 Author Posted November 8, 2013 That is a very helpful start. Thanks so much!
Lee Smith Posted November 8, 2013 Posted November 8, 2013 Why not attach a copy or mockup of your file. If you need an example of the steps to do this, see this step by step instruction. How to attach a file to your post Lee
pctechtv Posted November 9, 2013 Author Posted November 9, 2013 I did a little more research and produced a better script, I think. I say better because it works, no hourglass but don’t know if more in line with best practices. http://pctechtv.com/show/bpscript.png
comment Posted November 9, 2013 Posted November 9, 2013 It's not possible to assess a solution without understanding the problem it is designed to solve. Of that you have told us nothing and neither does your script. It looks like you are creating child records based on a list held in a field (or fields?) of the parent, but I cannot figure out what your tables are and what are the relationships between them. One thing that stands out is that your loops have a Go to Layout[] step but you never leave that layout, so that seems like a redundant repetition. --- BTW, "INFORMATION" is a really cryptic name for a table; all tables hold information. At least I haven't yet seen a table that contained socks or kitchen utensils... 2
Recommended Posts
This topic is 4032 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