curious99 Posted June 2, 2009 Posted June 2, 2009 Hi, this script works only for the first of a 99 item repeating global field. The field A is a local field with 99 repetitions. I'm trying to get 99 values from a repeating global field named "A" to change the values of a global field with 99 repeating values named "B". set field [filename: global;filename::a] Data is the following: value of repetition 1 of field A papa Value of repetition 2 of field A quebec value of repetition 3 of field A : romeo etc. value of repetition 1 of field B ( global ): blank ( all are blanck ) After running the script the result is the following : Value of repetition 1 field B : papa Value of repetition 2 field B : blank ( all the rest is blank) If I go another route, (just below), I get all blanks. set field [filename: global[99];getRepetition(filename::a;99)] What am I missing? Thanks Cheers
Raybaudi Posted June 2, 2009 Posted June 2, 2009 Loop Set Variable [ $rep ; Value: $rep + 1 ] Go to Field [ filename: global[ $rep ] ] Exit Loop If [ Get ( LastError ) = 102 ] Set Field [ [color:red]no field here ; filename::a[ $rep ] ] End Loop
curious99 Posted June 2, 2009 Author Posted June 2, 2009 Thanks, I'll try it out and will let you know the result. Cheers
curious99 Posted June 3, 2009 Author Posted June 3, 2009 Great! Works like a charm thank you so much! Just curious ( that's my name!) why 102 instead of 99 for the lasterror command? Cheers
Søren Dyhr Posted June 3, 2009 Posted June 3, 2009 Next question is if you really should need the tip for anything at all? Perhaps it might fall exactly here: http://fmforums.com/forum/showpost.php?post/149069/ Where it's said: You don't need to prepopulate the portal and you don't need a script. What you need is an X relation to the "template" records then a second relation to the actual test results. See attached. --sd
curious99 Posted June 3, 2009 Author Posted June 3, 2009 Hi Soren Dyhr, I had a look at the solution and indeed, it's powerfull and light in design. In this case, raybaudi's solution is perfect as it solved my issue. this being a pet project, I will leave it at that. However, I've suscribed to your solution. That way, I'll be able to dig into it if I need to. You all have a great one, I've always had the chance to get great help and advice thanks to each and everyone of you. I'me very grateful. You're part of my family now! Cheers! :beertime:
Raybaudi Posted June 3, 2009 Posted June 3, 2009 Just curious ( that's my name!) why 102 instead of 99 for the lasterror command? Error 102 is: "Field is missing" If you look at "FileMaker Pro error codes" into Help On Line you'll find no Error 99.
curious99 Posted June 3, 2009 Author Posted June 3, 2009 Thanks raybaudi, You really rock! Cheers ps, as I am adding this icon, makes me wonder if there is a way to import those icons into filemaker? I just tried to import it as an object into a multimedia field but it crashed my filemaker pro 9...any suggestions?
Søren Dyhr Posted June 3, 2009 Posted June 3, 2009 In this case, raybaudi's solution is perfect as it solved my issue. Scorched earth, could indeed be a strategy - but not necessarily something to make a habit of, when turning back to peace times - you're then regarded arsonist. But ...horses for courses. It's however a problem that repeating fields are breaking 1NF - Which means that there could be a point in refraining from their use as storage of raw data, and instead only use them as calc'fields only - and how are calc'fields reacting on scripting - well not directly. --sd
curious99 Posted June 3, 2009 Author Posted June 3, 2009 Sorry, You lost me there! My mother tongue is french...your answer is way too abstract for me. Whatever it means, I'm certain it's well intended. Hence thanks Cheers!
LaRetta Posted June 3, 2009 Posted June 3, 2009 It's however a problem that repeating fields are breaking 1NF - Ahem ... 99 values from a repeating global field named "A" to change the values of a global field with 99 repeating values named "B". What makes you think it holds regular data, Søren? If it does, it won't stick for lONG! Globals don't store data. Hey Curious99, Søren IS well-meaning but he SOMETIMES can get a bit out there. You are wise to just take it in. Months (sometimes years) later, his words might come back to you and they will fill in some strange hole in your understanding. And then again, sometimes not. :king:
curious99 Posted June 3, 2009 Author Posted June 3, 2009 Hi LaRetta, Great as I love philosophy and indeed most of the time it does take a while to grasp delightful messages within statements. In any case, like I said, this is a pet project. Being globals, I indeed have this script run at every opening of that database. Cheers to all
LaRetta Posted June 3, 2009 Posted June 3, 2009 Ahhhh hah!!! See Søren! Those fields do not store long-term perm data but rather they are for Developer use, which is a perfectly solid reason for using repeating fields. You jumped onto the non-normalized 1NF ship prematurely, huh? :(
Søren Dyhr Posted June 4, 2009 Posted June 4, 2009 You jumped onto the non-normalized 1NF ship prematurely, huh? Perhaps but one of the things normalization as such, set out to solve is to prevent syncronization issues - why is there something that gets out of sync, why has anything to be moved into a global where it suddenly gets a wider scope than the actual use, all globals can be accidentally changed because they can be reached without context. Such vulnerability needs a defence. I just wish to point out that the threads topic by and large neglect two of these 3 issues that: Database normalization is a formal process of designing your database to eliminate redundant data, utilize space efficiently and reduce update errors. ...namely by being inefficient in space utilisation and prone to update errors, no matter how much it's for the developers eyes only. --sd
curious99 Posted June 4, 2009 Author Posted June 4, 2009 Wooooow! I just looked at the transaltion of "scorched" and indeed this thread is getting to smell like it! There is no lightening smilies but this one might do ! I fully agree with you Soren, this is the way to go. After having browsed at the link supplied by mr Vodka ( :thanks: ) about 1NF, your point is indeed valid and well taken. However, being a pet project and not having enough time to get my hands into it at this point, like I said, I'll keep it as is. Again, thank you to raybaudi. I learned a lot from this post, philosophically (correct spelling?...again, my mother tongue is french) and programming wise. Merci à tous! Cheers Now back to work !
Recommended Posts
This topic is 5652 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