Crystal reports 2016
OLE DB to Microsoft SQL database
I have a database field "permissions" that is loaded with up to a 536 character string of "Y" or "N" with each position in the string representing a security state for different areas within an app (moronic, I know, but out of my control)
I need to build a report that shows the state of every area.
My plan was to parse through the field and load a shared boolean array (perm_on) with the states, then because those positions in the string aren't the same as the report order, I created another shared array (sort_order) to track report position, vs field position (far less apt to muck it up finally I also planned on using formulas to output a text string representing what was granted permission, so I hard coded a shared array perm_name with those values.
Originally I planned on using arrays directly in fill box formulas, but while I can declare shared variable arrays there, as soon as I use them in the if statement, crystal reports crashes
(code example that crashes crystal report)
I created over 810 formulas, the first formula created shared arrays, the second loaded it, the third was a test formula wasn't in use when problem first appeared, and doesn't impact result when used.
Formulas 4-405 are being used to show text for what permissions were for, being easier to title them as sequential numbers (001-402), followed by menu level (L1-L4), then area (sales/orders/etc)
Finally, formulas 406-808 being the one's I have issues with. which are formulas that result in a boolean to toggle fill state on boxes next to respective area labels
when I discovered those issues, I first deleted formulas 4-405 figuring I'd manually create text boxes, when deleting those didn't work, I tried deleting the first few boolean formulas, for every one I delete, one more further down the list works.
so
so first step, I made a formula to create the shared arrays, redim them based on len of "permissions", then loaded the sort_order and perm_name with a hard coded values
after that I created a the second formula to load shared array perm_on ( I know I don't need variable perm_bit, but I created it when debugging earlier issue with misspelled variable
I created 402 formulas called B001 to B402
with the code returning true or false based on permission location that was stored in sort_order
example B402 has the code
for each of the boxes I used code that looked at the correct "B" formula ((B001 to B402) based on it's position in the report) in the fill formula (I guess that technically means I created over 12,00 formulas
I checked SAP, they mention various limitations, but nothing specific about formulas.
After typing this question out, I wonder if it has to do with the number of formulas resulting in boolean, versus just total number of formulas or even number of boxes with formulas?
When Linux is Free and Open, who needs Windows or Gates?
OLE DB to Microsoft SQL database
I have a database field "permissions" that is loaded with up to a 536 character string of "Y" or "N" with each position in the string representing a security state for different areas within an app (moronic, I know, but out of my control)
I need to build a report that shows the state of every area.
My plan was to parse through the field and load a shared boolean array (perm_on) with the states, then because those positions in the string aren't the same as the report order, I created another shared array (sort_order) to track report position, vs field position (far less apt to muck it up finally I also planned on using formulas to output a text string representing what was granted permission, so I hard coded a shared array perm_name with those values.
Originally I planned on using arrays directly in fill box formulas, but while I can declare shared variable arrays there, as soon as I use them in the if statement, crystal reports crashes
(code example that crashes crystal report)
Code:
shared numbervar array sort_order;
shared booleanvar array perm_on;
if perm_on[sort_order[1]
then crBlack
else crNocolor;
I created over 810 formulas, the first formula created shared arrays, the second loaded it, the third was a test formula wasn't in use when problem first appeared, and doesn't impact result when used.
Formulas 4-405 are being used to show text for what permissions were for, being easier to title them as sequential numbers (001-402), followed by menu level (L1-L4), then area (sales/orders/etc)
Finally, formulas 406-808 being the one's I have issues with. which are formulas that result in a boolean to toggle fill state on boxes next to respective area labels
when I discovered those issues, I first deleted formulas 4-405 figuring I'd manually create text boxes, when deleting those didn't work, I tried deleting the first few boolean formulas, for every one I delete, one more further down the list works.
so
so first step, I made a formula to create the shared arrays, redim them based on len of "permissions", then loaded the sort_order and perm_name with a hard coded values
Code:
shared stringvar array perm_bit;
shared numbervar array sort_order;
shared stringvar array perm_name;
shared booleanvar array perm_on;
shared numbervar perm_length;
local numbervar i;
perm_length:=len({PermissionCodes.Permissions});
redim perm_bit[perm_length];
redim sort_order[perm_length];
redim perm_name[perm_length];
redim perm_on[perm_length];
sort_order[1]:=1;
sort_order[2]:=2;
sort_order[3]:=3;
sort_order[4]:=4;
sort_order[5]:=5;
sort_order[6]:=6;
sort_order[7]:=370;
sort_order[8]:=382;
sort_order[9]:=9;
sort_order[10]:=7;
sort_order[11]:=8;
snip.......
sort_0rder[536]:=536;
perm_name[1]:="Point Of Sale";
perm_name[2]:="Left Side Menu";
perm_name[3]:="Sales";
perm_name[4]:="Orders";
perm_name[5]:="Quotes";
snip....
perm_name[485]:="Requests"; // perm_name loaded out of order because I used the spreadsheet which has the menu items, and their order to create the code
"";
after that I created a the second formula to load shared array perm_on ( I know I don't need variable perm_bit, but I created it when debugging earlier issue with misspelled variable
Code:
shared stringvar array perm_bit;
shared numbervar array sort_order;
shared booleanvar array perm_on;
shared numbervar perm_length;
local numbervar i;
for i:=1 to perm_length do
(
perm_bit[i]:=mid({PermissionCodes.Permissions},i,1);
if perm_bit[i]="Y"
then perm_on[i]:=true
else perm_on[i]:=false;
);
"";
I created 402 formulas called B001 to B402
with the code returning true or false based on permission location that was stored in sort_order
example B402 has the code
Code:
shared numbervar array sort_order;
shared booleanvar array perm_on;
perm_on[sort_order[402]];
for each of the boxes I used code that looked at the correct "B" formula ((B001 to B402) based on it's position in the report) in the fill formula (I guess that technically means I created over 12,00 formulas
Code:
if {@B001}
then crBlack
else crNocolor;
I checked SAP, they mention various limitations, but nothing specific about formulas.
After typing this question out, I wonder if it has to do with the number of formulas resulting in boolean, versus just total number of formulas or even number of boxes with formulas?
When Linux is Free and Open, who needs Windows or Gates?