Jump to content

can a parameter use a variable in ireport?


rida_10

Recommended Posts

Hello Every One,

 

as a matter of fact, i have a parameter that shouled be processed first then used in my query,

so i created the first parameter as $P{RAW_PARAM},

then i created second parameter $P{PARSED_PARAM} that has an expression like this pattern:

$V{MY_VARIABLE}.process( $P{RAW_PARAM} ) where function process returns the result that should be used in my query

and where variable MY_VARIABLE is an instance of a userdefined class  .

all this introduction to say that  i am printing $P{PARSED_PARAM} and the result is null why ?

although i have created a text field and gave it same expression as in the $P{PARSED_PARAM} and it give the expected result

and that is why i didn't post my code

so can a parameter use a variable

 

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi, i'm not 100% sure but i think no =)

For me the elements of the report are generated from top to bottom of your left panel ( styles are created, then parameters, then fields, then variable, ...) so when it comes to diplay your field in a band it 's ok but as the variable are calculated after the params and fields it cannot work in your query

Let me know if i understand well your question or if what i m saying if wrong

Regards

Link to comment
Share on other sites

Well, I believe that variables are processed during the query execution, while parameters are set prior to the query being executed. Not sure if I'm understanding your question correctly, but I don't believe what you're trying to do is going to work out.

 

David

Link to comment
Share on other sites

ok braxivamov, first good morning,
yes, i think that u are targeting my question, but i want to ask how to process a given parameter before submitting it to the query especiallay if my processing contains a loop, in other words i want to transform the
comming parameter having this pattern: (abc:1, def:23, ghi:359, xyz: 39....) {a multi-select combo box value} TO this pattern :

WHERE (TreeId = abc AND NodeId = 1)      OR
                (TreeId =def   AND NodeId = 23 )  OR
                (TreeId =def   AND NodeId = 23 )  OR
                (TreeId =ghi   AND NodeId = 359 ) OR
                (TreeId =ghi   AND NodeId = 359 ) OR
                 (TreeId =xyz   AND NodeId = 39 ) OR
    ......
              

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...