R&R Xbase crashes

Meeting place for R&R customers and clients to share tips and ideas. Post your questions, messages or problems here.
Post Reply
happydermis
Posts: 63
Joined: Tue Oct 10, 2017 12:44 pm

R&R Xbase crashes

Post by happydermis » Wed Dec 08, 2004 11:57 am

Hi all,__I have the following problem: I am trying to change a report that was made by a former worker in my company. Every time whenI start the report is counts the needed values but in the moment where it is done I get an error and R&R simply shuts down :-(____Report^s task: calculate the sales volume for the beginning of the year until a given week. Further it calculates sale volumes for the next 10 weeks. The thing is that I needed to program a piece of code in the report so I will not get an overflow in the count of the weeks. At the moment it is dumb-programmed so you must change it every year so the date will be correct____How does it work?: the person using the report inputs the number of the week and the year (example: 23 or 5) and than the given year (2004 or 2007 etc.) and the report calculates the sales volume for the given weeks. The guy who programed this report didn^t use a real date type, but the week is simply added to the year, example: 200405 is the fifth week in the year 2004, 200853 is the last week in the year 2008...__ __What did I try to do?: I worked on a formula that will find out if the current year is a leap year or not (a leap year has 53 weeks instead of the normal 52 weeks in a year) and than decide which jear and month it should write in each column.____How does it look like?: IIF(MOD(startJahr,4)>0,IIF(startWoc1>52,(startJahr+1)*100+(startWoc1-52),startJahr*100+startWoc1),IIF(startWoc1>53,(startJahr+1)*100+(startWoc1-53),startJahr*100+startWoc1))____And now in words: if the year is not a leap year calculate the right week according to 52 weeks in a year. If the year is a leap year calculate the right week according to 53 weeks in a year. If yo need more information about the code please let me know!____I think I have managed to narrow the problem to my code. The thing is: I don_t know why it is crashes. I_ve looked at it for some time and couldn_t come up with any idea. Anyone got an idea??____Thanks in advance, Dekers______

kfleming
Posts: 5795
Joined: Tue Oct 10, 2017 12:44 pm

=> RE: R&R Xbase crashes

Post by kfleming » Wed Dec 08, 2004 10:52 pm

If you delete this calculation does the report then print successfully? Maybe it is not the real cause of the problem.____Kathleen__R&R Support

happydermis
Posts: 63
Joined: Tue Oct 10, 2017 12:44 pm

==> RE: R&R Xbase crashes

Post by happydermis » Thu Dec 09, 2004 12:25 pm

Well, the report was working before - it was simply stupidly programmed...__When I take out the calculation the report runs smoothly.____Maybe this is a stupid question but can R&R handle so many "IIFs"? I come from the PHP world so I am used for many IFs, WHILEs etc...____Thanks, Dekers

kfleming
Posts: 5795
Joined: Tue Oct 10, 2017 12:44 pm

===> RE: R&R Xbase crashes

Post by kfleming » Thu Dec 09, 2004 6:27 pm

You could try breaking the single calc into two separate calcs.____SO CalcB would do some of the test and CalcA would have__IIF(condition,truevalue,CalcB)____So calcA would call calcB.____Kathleen__R&R Support

happydermis
Posts: 63
Joined: Tue Oct 10, 2017 12:44 pm

====> RE: R&R Xbase crashes

Post by happydermis » Fri Dec 10, 2004 3:00 pm

Kathleen,____I didn^t understand exactly what you mean. I will try to eliminate some portions of the code inside the main "IIF" and see if anything changes. Maybe I have a logical error that I simply don^t notice...____Thanks, Dekers

happydermis
Posts: 63
Joined: Tue Oct 10, 2017 12:44 pm

=====> RE: R&R Xbase crashes

Post by happydermis » Tue Dec 14, 2004 1:32 pm

Well...__The solution was rather embarrassing - all formulas did function correctly. The reason for the crash was one field that calculated the original year and week (startYear*100+startWeek). The user would give the number of the week- for example week 50 and the year- for example 2004. So let^s calculate: 2004*100+50=200450. I simply had to erase this field and make a new one with the same formula and BINGO! it worked as smooth as a baby^s behinds.____Dekers

Post Reply