1. jaume
  2. Valentina Reports ADK
  3. Суббота, Февраль 01 2020, 11:58 AM
  4.  Подписаться через email
Hello,
I have a report with a subreport

I print the report and i also use parameters

One parameter is used to hidde or not to hide some columns in the subreport

I hide a field like " report.controls.PREUVENDA1.print = false;"

running the report field PREVENDA1 is not showed , that is correct.

The problem is that PREVEUFENDA1 is not show any more, even you edit the subreport change false by true. The only way to get PREUVENDA1 showed again is restoring a report backup. It is really frustating.

Jaume
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Hello Jaume,

What type of control PREUVENDA1 is? A field?

You have
" report.controls.PREUVENDA1.print = false;"

in some script of the subreport, which one?

Then you edit this script and set to true but the control is not shown anyway.
Is that how it happens?
Комментарий
There are no comments made yet.
jaume Ответ принят
Yes, it is a field.

Pre_build.

if it is set = false it is not shown

if it set = true it is not shown

if line it is removed it is shown again
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
The issue is that properties don't accept true/false now, only 1/0.
The following should work:
report.controls.PREUVENDA1.print = 1;
Комментарий
There are no comments made yet.
jaume Ответ принят
Do the report parameters must be redeclared in the subreport ?
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
No, it’s not necessary.
Комментарий
There are no comments made yet.
jaume Ответ принят
I have in main report script
var v = report.parameterValue('param3');

if (v == 'N') {
report.controls.label22.print ='';
report.controls.expression12.print = 0;
report.controls.expression11.print = 0;
report.controls.label25.print = 0;

}

and it works fine

in the subreport I have this sniped code

var v = report.parameterValue('param3');

if (v == 'N') {
report.controls.PREUVENDA1.print = 0;
report.controls.DPTE1.print = 0;
report.controls.IMPORT1.print =0 ;

}

and the report controls are printed always even v =='N'

What am i doing wrong ?
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Looks correct. Is it in the Valentina Studio? How do you define the parameter?

Added screenshots of how it worked for me.
Вложения
Комментарий
There are no comments made yet.
jaume Ответ принят
is it possible that only parameters used in the query in the subreport are available in the subreport and the rest of parameters are ignored ?
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
No, that's not expected.
If the parameter is declared on the parameters tab of the main report - it must be visible to subreport in scripts and expressions.
Комментарий
There are no comments made yet.
jaume Ответ принят
I added expression on main report to print param3 as "$P(param3) and it is printed.
I added expression on subreport to print param3 as "$P(param3) and report is not printed ( expression and report is not printed)
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Is it in the Valentina Studio of the latest version?
Parameter param3 is added on the parameters tab in the main report, right?

( expression and report is not printed)

So you run main report - and what happens? Nothing printed? Or the expression is empty?
Вложения
Комментарий
There are no comments made yet.
jaume Ответ принят
yes, it is added

Main report is printed and expresion param3 is printed
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Can't reproduce it in version 9.8.2, expressions were added to the main report and subreport and in both cases, the parameter value was set correctly.

When you run the main report - parameter in main report is printed, parameter in subreport is not printed, correct?
Do you see it in any report? Maybe try to do it in a new simpler report-subreport.
Вложения
Комментарий
There are no comments made yet.
jaume Ответ принят
Parameter in main report is printed, but is not printed the subreport nor parameter. If I remove parameter in sub report, subreport is printed.

I did it before contact with suport. Unfortunelly the result was the same.
Комментарий
There are no comments made yet.
jaume Ответ принят
Parameter in main report is printed, but is not printed the subreport nor parameter. If I remove parameter in sub report, subreport is printed.

Parametres are working okey in the subreport query but not in the body subreport or subreport scripts.

I did it before contact with suport. Unfortunelly the result was the same.
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Subreport not printed - how does it look like? All controls not printed, no empty spaces, no errors, just the controls of the main report?
Maybe you can add screenshots - main report layout, subreport layout, preview?
Комментарий
There are no comments made yet.
jaume Ответ принят
Hello, I can see param3 in the subreport rightnow and the value is correct

but can't hide columms

What am I doing wrong ?
Вложения
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Looks correct,

Is the parameter name "param3" is exactly the same as it was defined, no upper case in it?

At first, I would try to hide the field without any parameters conditions, to see if the print property fails
report.controls.DPTE1.print = 0;
Комментарий
There are no comments made yet.
jaume Ответ принят
whitout conditions works properly.

the value of param3 is displayed in the report "N" - first screenshot- it's correct.

there is no capital letters
Вложения
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Actually printing parameters using macro $P and getting it in script go different code paths.

There's a way to check what is returned from report.parameterValue function.

Just add an empty expression somewhere in this report and assign variable with parameter value to this expression in pre_build script:
var v1 = report.parameterValue( 'param3' );
report.controls.expression1.label = v1;
Вложения
Комментарий
There are no comments made yet.
  • Страница :
  • 1
  • 2


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories