Question

I'm trying to convert old crystal reports into SSRS reports for my company, and have come across a report with some VB that is confusing, to say the least. If someone could break this down into pseudocode to help me get the ssrs to report the correct info, I'd appreciate it a lot!

stringvar BROKER;

if {LOAN_IPT.INTEREST} like "*BROKER" then BROKER := {LOAN_IPT.SHORT_NAME}&"   *** SHORT NAME ***" else BROKER;
if {LOAN_IPT.INTEREST} like "*BROKER" and isnull({CARDINDX.DESCRIPTION}) 
    then BROKER := {LOAN_IPT.SHORT_NAME}&"   *** SHORT NAME ***" else 
    (if {LOAN_IPT.INTEREST} like "*BROKER" then BROKER :={CARDINDX.DESCRIPTION} else BROKER);

EDIT: Let me explain that I Know that this is not a code translation service here at stackoverflow. I am asking that someone who is more knowledgeable than me assist with some insight as to what is going on here. It appears that there is some redundancy that is not needed and I am trying to condense it down into a more readable version. Like I said... I appreciate any help but negative comments are not helpful at all. I thought that this site is to help answer code related questions so that like minded people can work together on unusual situations. I am sorry if I do not have a "specific" question here. I am only reaching out to a group of people that I feel would have a better understanding than I with the hopes that someone would understand that code for what it is and relay it back to me in a bit more layman's terms.

Was it helpful?

Solution

To be fair, that snippet of code is so overly convoluted that a little guidance wouldn't hurt.

Here's how I would rewrite it:

if {LOAN_IPT.INTEREST} like "*BROKER" //string match on field
then (if isnull({CARDINDX.DESCRIPTION}) then {LOAN_IPT.SHORT_NAME}&"   *** SHORT NAME ***"
      else {CARDINDX.DESCRIPTION})

else "" //if string match fails, return empty string

EDIT: It just occurred to me that if a string match fails, an empty string is not necessarily returned, but rather the value of the BROKER variable which could have been set elsewhere in the report. You will need to search other formulas in the report to see if any of them use that same variable (my guess is that they don't, but you never know).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top