crystal report xi, windows 7
I am creating a sub-report which I will eventually link to the main report when it's working.
I created three array variables, one string, two number.
My member contact records have an industry code so I sort and group by industry code - which I've actually translated to industry name - and using running totals, count the # of records - members - in an industry, reset on a change of group (industry), and the count of groups, not reset.
what I'm trying to do is to calculate the page number in the membership directory, based on the number of member contacts in each industry.
I started with using global array variables and all worked well, but of course I had to switch to shared variables so I changed the scope of the global array variables to shared - and then the trouble began.
Each time I updated the shared array element with a value - industry name, # members in an industry or industry page # - the preceding value was cleared out, i.e. when I updated the values in the 2nd element of the arrays, the values in the first element of the array were zero for number arrays and "" for the string array; updating the values to the fifth element, the first four were cleared - but the first three would have been cleared when the formula was processed for those elements. the global variables had worked fine.
then I changed the scope of shared array variables back to global and created corresponding new shared array variables, no luck, same problem with the shared arrays.
then I created two shared string variables in which I concatenated i) the industry name or ii) totext(members in industry) at the point that I updated the arrays, assuming that I'd get a string of i) industry names and ii) number of members in the industry; but that gets cleared out as well and the string variables contain only the values of the last element in the group. I printed the strings in the group footer and each time, it held only the group industry name an number of members of the last array element.
of course, this worked fine for the global string variables.
I have a formula in the report footer that reports the values in global and shared arrays. the global are all correct, but the shared contains a value in only the last element.
then, I created a formula to initialize the shared string array and string variables with dummy data and put it in the report header; I had no formulae anywhere in the report that updated the shared arrays and strings so the shared array and string calculations and updates weren't done. I printed the string variables in the group footer; the industry name string was fine and never changed, but the # of members string didn't print anything.
the formula in the report footer, showing the industry name, # of members, and the page number for each shared array element, the the first six elements were as I had entered them in the initialization formula - the # of members for each industry were also as I had initialized them even though the string never reported in the group footers - and the remining ones had blank industry names and 0 members in industry; the page # perpetuated based on no members in the industry and was the same for the all of the remaining elements. that was correct based on the data.
so, finally, in the formula that I put in the in the report footer, I copied the elements from the global arrays to the shared arrays which did actually work, but seems a very inelegant solution; I had hoped to not have to use the global array variables at all and just have the shared array variables.
it seems the array isn't the problem, as the string variables are also cleared. in each formula where I use the shared array variables I declare shared stringvar array industry_names and shared numbervar array members_in_industry and the string variables, which I thought was what I had to do and is what I do with the global array variables; am I clearing out the arrays when I do that? not from what I understand and the global arrays don't do that.
I know that it sounds like I've redimmed the arrays and initialized the strings, but I really haven't, honestly.
I have blethered on at great length, but it was to give you as much information as possible so you wouldn't need to ask a lot of questions.
I'm really missing something about shared variables; I've used shared variables before, but not shared arrays; of course the string variable doesn't seem to be working either.
of course I'll be happy to send whatever will help but didn't want to send something not useful.
By the way, is there anyway to interupt processing in a formula to see what's happening like you can in Visual Basic, other than by setting up a divide by zero; CR doesn't seem to have much in the way of debugging tools.
well, thanks for getting through all of that; it would be so wonderful if someone can help me out, the directory is coming out n a couple of weeks.
thanks
Kim
I am creating a sub-report which I will eventually link to the main report when it's working.
I created three array variables, one string, two number.
My member contact records have an industry code so I sort and group by industry code - which I've actually translated to industry name - and using running totals, count the # of records - members - in an industry, reset on a change of group (industry), and the count of groups, not reset.
what I'm trying to do is to calculate the page number in the membership directory, based on the number of member contacts in each industry.
I started with using global array variables and all worked well, but of course I had to switch to shared variables so I changed the scope of the global array variables to shared - and then the trouble began.
Each time I updated the shared array element with a value - industry name, # members in an industry or industry page # - the preceding value was cleared out, i.e. when I updated the values in the 2nd element of the arrays, the values in the first element of the array were zero for number arrays and "" for the string array; updating the values to the fifth element, the first four were cleared - but the first three would have been cleared when the formula was processed for those elements. the global variables had worked fine.
then I changed the scope of shared array variables back to global and created corresponding new shared array variables, no luck, same problem with the shared arrays.
then I created two shared string variables in which I concatenated i) the industry name or ii) totext(members in industry) at the point that I updated the arrays, assuming that I'd get a string of i) industry names and ii) number of members in the industry; but that gets cleared out as well and the string variables contain only the values of the last element in the group. I printed the strings in the group footer and each time, it held only the group industry name an number of members of the last array element.
of course, this worked fine for the global string variables.
I have a formula in the report footer that reports the values in global and shared arrays. the global are all correct, but the shared contains a value in only the last element.
then, I created a formula to initialize the shared string array and string variables with dummy data and put it in the report header; I had no formulae anywhere in the report that updated the shared arrays and strings so the shared array and string calculations and updates weren't done. I printed the string variables in the group footer; the industry name string was fine and never changed, but the # of members string didn't print anything.
the formula in the report footer, showing the industry name, # of members, and the page number for each shared array element, the the first six elements were as I had entered them in the initialization formula - the # of members for each industry were also as I had initialized them even though the string never reported in the group footers - and the remining ones had blank industry names and 0 members in industry; the page # perpetuated based on no members in the industry and was the same for the all of the remaining elements. that was correct based on the data.
so, finally, in the formula that I put in the in the report footer, I copied the elements from the global arrays to the shared arrays which did actually work, but seems a very inelegant solution; I had hoped to not have to use the global array variables at all and just have the shared array variables.
it seems the array isn't the problem, as the string variables are also cleared. in each formula where I use the shared array variables I declare shared stringvar array industry_names and shared numbervar array members_in_industry and the string variables, which I thought was what I had to do and is what I do with the global array variables; am I clearing out the arrays when I do that? not from what I understand and the global arrays don't do that.
I know that it sounds like I've redimmed the arrays and initialized the strings, but I really haven't, honestly.
I have blethered on at great length, but it was to give you as much information as possible so you wouldn't need to ask a lot of questions.
I'm really missing something about shared variables; I've used shared variables before, but not shared arrays; of course the string variable doesn't seem to be working either.
of course I'll be happy to send whatever will help but didn't want to send something not useful.
By the way, is there anyway to interupt processing in a formula to see what's happening like you can in Visual Basic, other than by setting up a divide by zero; CR doesn't seem to have much in the way of debugging tools.
well, thanks for getting through all of that; it would be so wonderful if someone can help me out, the directory is coming out n a couple of weeks.
thanks
Kim