March 2, 200520 yr I have a strange calc problem which I would need some help with. Basic I have a 52 rep number field and a 52 rep calc field set to container result Depending on the number value (nm) I want to get a pic from a container field. This is my calc (shortened) Let ( [ Nm=P_weeknm; High=User Season::WeekHigh; Low=User Season::WeekLow; Bar1=Graphic::Weekbars1; Bar2=Graphic::Weekbars2; Bar3=Graphic::Weekbars3; Bar4=Graphic::Weekbars4; Bar5=Graphic::Weekbars5; Bar6=Graphic::Weekbars6 ]; Case( Nm < GetRepetition(High;1); GetRepetition( Bar1;Round (nm;0)) ; GetRepetition( Bar2;Round (nm;0)) )) It works good if the nm value is below 11, but then it doesn't show anything. If I only have one case() option (or skip it) I get good values (but then it's useless...) example: Let ( [ Nm=P_weeknm; High=User Season::WeekHigh; Low=User Season::WeekLow; Bar1=Graphic::Weekbars1; Bar2=Graphic::Weekbars2; Bar3=Graphic::Weekbars3; Bar4=Graphic::Weekbars4; Bar5=Graphic::Weekbars5; Bar6=Graphic::Weekbars6 ]; Case( 1=1; GetRepetition( Bar2;Round (nm;0)) )) Does anyone now what I'm doing wrong?
March 2, 200520 yr I am a bit confused by your calc. It appears you have several non-repeating fields in the mix - have you tried using Extend() around them?
March 2, 200520 yr Author OK, didn't know about extend ..... maybe that's giving me some troubles ... and maybe my whole calc is a bad one ... The case is this.... Nm = 52 rep High = 6 rep Low = 6 rep Bar1 = 40 rep Bar2 = 40 rep Bar3 = 40 rep Bar4 = 40 rep Bar5 = 40 rep Bar6 = 40 rep ... and the calc field has 52 reps So all the fields have reps but only nm and calc field has 52. The extend function makes it possible to use a non-rep field (not the case here) if I've understood it correctly?
March 2, 200520 yr Could you perhaps post your file? There's too much going on at once - (relationships, multiple repeating fields) to spot the problem just from the information you provided.
March 2, 200520 yr Just a hunch - try, instead of this: -------------------------------------- Case( Nm < GetRepetition(High;1); GetRepetition( Bar1;Round (nm;0)) ; GetRepetition( Bar2;Round (nm;0)) -------------------------------------- Let ( [ ... result1 = GetRepetition ( Bar1 ; Round (nm ; 0 ) ) ; result2 = GetRepetition ( Bar2 ; Round (nm ; 0 ) ) ] ; Case( Nm < GetRepetition ( High ; 1 ) ; result1 ; result2 ) )
March 3, 200520 yr Author Made a new file with the same basic stuff, the calc ain't working good..... test_1.zip
March 3, 200520 yr Ok, a couple of things: 1. I have rewritten your calc, and it appears to work. I cannot tell you if that is a result of the rewrite - I simply had to rewrite it, otherwise I had no idea what I was testing. 2. When you refer from a repetition of one repeating field to another repetition of another repeating field - you will experience refresh problems. After changing the data in High/Low, I had to re-enter the data in WeekTime in order to get the correct display. I have no idea what this is supposed to do, but I would consider moving some of the data, especially the highs and lows, out of repeating fields. test.fp7.zip
March 3, 200520 yr Author I don't know if I have some filemaker settings set falsly but there is no difference in my file. I don't get bars in every field that has a nm value in the corresponding rep..... And the bars I get ai'nt the correct ones... switching of the global storing of the active data fields give me the correctly related weekvalues, thats one good thing... I have no idea what this is supposed to do, but I would consider moving some of the data, especially the highs and lows, out of repeating fields. Well..... The thing I'm trying to accomplish is the following It's a simple planning layout for a user. The Nm field is the time he well train, one rep for each week of the year (time is set by a number) Then in his user settings he has specified that for an example a heavy training week for him is between 12-15 h If it's a recovery week the calc should get a bar from the Bar1 field, if it's an easy from bar2 etc
March 3, 200520 yr Author or perhaps it is working, I must have switched the bar fields in the test file, it is working, or at least i think it is.. Thanks comment I'm very grateful for your help
March 3, 200520 yr I can't say I understand it completely, but I think you should consider: (a) A record per user per week, instead of 52 repeats. For any kind of report, this will be essential. ( I would make the calculations work as pure numbers first, before dealing with the fancy display.
Create an account or sign in to comment