MTarkington
Programmer
Ok, first I'll apologize if there's been anything like this on here before, but I did not have any idea where to start looking.
I have a table that has 80 fields that correspond to each other (ex: Code_Authorized_1 - Authorized_units_1; Code_Authorized_2 - Authorized_units_2). I am creating a formula to display all 80 of these fields for the purpose of utilizing a parameter.
Now, the way Crystal is working is that if the first set of these fields is populated, but the second set is not, it will not display any of the fields, but if there are 2 sets of the fields populated, it will display them.
This is with the below formula:
trim(authorized_code_1)+'-'+trim(units_authorized_1)+';'+
trim(authorized_code_2)+'-'+trim(units_authorized_2)
I was planning on putting all 80 of these fields in a formula like the above, but it creates the problem I described. It will ignore the first string if the second string is not populated. We know for a fact that all 80 of the fields we are using are not populated, thus the above formula will not work.
My first thought is to create a massive nested if that looks like this:
if isnull(code_authorized_2) then
trim(code_authorized_1)+'-'+trim(units_authorized_1)
else
if isnull(code_authorized_3) then
trim(code_authorized_1)+'-'+trim(units_authorized_1)+';'+
trim(code_authorized_2)+'-'+trim(units_authorized_2)
else
if isnull(code_authorized_4) then
trim(code_authorized_1)+'-'+trim(units_authorized_1)+';'+
trim(code_authorized_2)+'-'+trim(units_authorized_2)+';'+
trim(code_authorized_3)+'-'+trim(units_authorized_3)
else...
And so on...
I know this code works. It is displaying the information we need, but for 40 sets of 2 corresponding fields, this will, hands down be the largest IF statement I have ever coded.
I am sure there has to be an easier way to do this, but I can't figure it out.
The database is in Cache. Using Crystal 10.
Please let me know if any of the above needs any kind of clarification. (I'll be surprised if it doesn't)
TIA,
Mark
I have a table that has 80 fields that correspond to each other (ex: Code_Authorized_1 - Authorized_units_1; Code_Authorized_2 - Authorized_units_2). I am creating a formula to display all 80 of these fields for the purpose of utilizing a parameter.
Now, the way Crystal is working is that if the first set of these fields is populated, but the second set is not, it will not display any of the fields, but if there are 2 sets of the fields populated, it will display them.
This is with the below formula:
trim(authorized_code_1)+'-'+trim(units_authorized_1)+';'+
trim(authorized_code_2)+'-'+trim(units_authorized_2)
I was planning on putting all 80 of these fields in a formula like the above, but it creates the problem I described. It will ignore the first string if the second string is not populated. We know for a fact that all 80 of the fields we are using are not populated, thus the above formula will not work.
My first thought is to create a massive nested if that looks like this:
if isnull(code_authorized_2) then
trim(code_authorized_1)+'-'+trim(units_authorized_1)
else
if isnull(code_authorized_3) then
trim(code_authorized_1)+'-'+trim(units_authorized_1)+';'+
trim(code_authorized_2)+'-'+trim(units_authorized_2)
else
if isnull(code_authorized_4) then
trim(code_authorized_1)+'-'+trim(units_authorized_1)+';'+
trim(code_authorized_2)+'-'+trim(units_authorized_2)+';'+
trim(code_authorized_3)+'-'+trim(units_authorized_3)
else...
And so on...
I know this code works. It is displaying the information we need, but for 40 sets of 2 corresponding fields, this will, hands down be the largest IF statement I have ever coded.
I am sure there has to be an easier way to do this, but I can't figure it out.
The database is in Cache. Using Crystal 10.
Please let me know if any of the above needs any kind of clarification. (I'll be surprised if it doesn't)
TIA,
Mark