Variable Initialization
-
- Posts: 32
- Joined: Tue Jul 03, 2012 2:16 pm
Variable Initialization
Hello.
I'm trying to initialize a variable using the "expression" option, and setting it's value to a field in my Bussiness Objects.
But when I run my report, I get an generic error message.
My code seems like:
myIntVar = MyBussinessObject.AnIntValue
Thanks.
I'm trying to initialize a variable using the "expression" option, and setting it's value to a field in my Bussiness Objects.
But when I run my report, I get an generic error message.
My code seems like:
myIntVar = MyBussinessObject.AnIntValue
Thanks.
Re: Variable Initialization
Hello.
Where do you try to initialize variable with this expression?
Please, describe your issue more detailed.
Thank you.
Where do you try to initialize variable with this expression?
Please, describe your issue more detailed.
Thank you.
-
- Posts: 32
- Joined: Tue Jul 03, 2012 2:16 pm
Re: Variable Initialization
Hello.
I'm trying to initialize the variable in the New Variable window.
I've attached a printscreen of what I'm trying to do.
Thanks.
I'm trying to initialize the variable in the New Variable window.
I've attached a printscreen of what I'm trying to do.
Thanks.
- Attachments
-
- Var.png (14.06 KiB) Viewed 4595 times
Re: Variable Initialization
Hello.
Please, try to enable the Read Only option. Then the variable will be calculated each time.
Thank you.
Please, try to enable the Read Only option. Then the variable will be calculated each time.
Thank you.
-
- Posts: 32
- Joined: Tue Jul 03, 2012 2:16 pm
Re: Variable Initialization
Hello.
Thanks for the quickly reply.
It worked, but sometimes this variable needs to be reassigned, as I use it as a counter.
So in my case, I cannot set it as Read Only.
What can I do?
Thanks.
Thanks for the quickly reply.
It worked, but sometimes this variable needs to be reassigned, as I use it as a counter.
So in my case, I cannot set it as Read Only.
What can I do?
Thanks.
Re: Variable Initialization
Hello, Daniel.
You could change the variable's value in a BeforePrint event of a Data Band or some where else. And don't use the init expression.
Thank you.
You could change the variable's value in a BeforePrint event of a Data Band or some where else. And don't use the init expression.
Thank you.
-
- Posts: 32
- Joined: Tue Jul 03, 2012 2:16 pm
Re: Variable Initialization
Hello.
Yes, I'm changing it's value in the BeforePrint event of my PageHeader, in this case counting the number of pages, incrementing it's value by 1.
But I need to initialize it by a value that comes from my bussiness object.
So, if my BO has the value 5, I need start counting from page 6: 6, 7, 8, ...
Sorry if I was not so clear before.
Thanks.
Yes, I'm changing it's value in the BeforePrint event of my PageHeader, in this case counting the number of pages, incrementing it's value by 1.
But I need to initialize it by a value that comes from my bussiness object.
So, if my BO has the value 5, I need start counting from page 6: 6, 7, 8, ...
Sorry if I was not so clear before.
Thanks.
-
- Posts: 32
- Joined: Tue Jul 03, 2012 2:16 pm
Re: Variable Initialization
Hello.
I was debugging my code, searching for something, and the error I got in the file I've attached.
I got the same error debugging your sample code.
Another solution I've tryied was to use the PageNumber property.
It worked fine, but I could'nt get how do I reset the counter, as I need it to happen when PageNumber get equals to a parameter I have.
Thanks.
I was debugging my code, searching for something, and the error I got in the file I've attached.
I got the same error debugging your sample code.
Another solution I've tryied was to use the PageNumber property.
It worked fine, but I could'nt get how do I reset the counter, as I need it to happen when PageNumber get equals to a parameter I have.
Thanks.
- Attachments
-
- Error.txt
- (4.69 KiB) Downloaded 457 times
Re: Variable Initialization
Hello, Daniel.
Thank you.
It seems that you are using partial trust mode. Please, try to set next option:Daniel Schmitz wrote:I was debugging my code, searching for something, and the error I got in the file I've attached.
I got the same error debugging your sample code.
Code: Select all
StiOptions.Engine.FullTrust = false;
You could try to use Reset Page Number property of the Page Header.Daniel Schmitz wrote:Another solution I've tryied was to use the PageNumber property.
It worked fine, but I could'nt get how do I reset the counter, as I need it to happen when PageNumber get equals to a parameter I have.
Thank you.
-
- Posts: 32
- Joined: Tue Jul 03, 2012 2:16 pm
Re: Variable Initialization
Hello.
I tried to set FullTrust = false, but now the report don't load any of my data.
I've also tried to use the Reset Page Number property in the AfterPrint event of my PageHeaderBand1, with a text displaying the PageNumber in it:
if(PageNumber == 10)
{
PageHeaderBand1.ResetPageNumber = true;
}
else
{
PageHeaderBand1.ResetPageNumber = false;
}
But for some reason, PageNumber == 10 it's getting true when my text is displying 8.
Is there something wrong?
Thanks
I tried to set FullTrust = false, but now the report don't load any of my data.
I've also tried to use the Reset Page Number property in the AfterPrint event of my PageHeaderBand1, with a text displaying the PageNumber in it:
if(PageNumber == 10)
{
PageHeaderBand1.ResetPageNumber = true;
}
else
{
PageHeaderBand1.ResetPageNumber = false;
}
But for some reason, PageNumber == 10 it's getting true when my text is displying 8.
Is there something wrong?
Thanks