Hi.
I have a report, with a variable named CULTURE, with value "es-ES". The expression used in Report Culture Property is {CULTURE}
In Stimulsoft Designer, report renders fine. If we change CULTURE value to "en-US", reports shows english translations on preview. That's fine.
But, when I launch the report from PHP, and I set the CULTURE value to "en-US" in onPrepareVariables event, variable is set with value "en-US" successfully (we show value in report detail and it shows "en-US"), but report not render in English. We try with AutoLocalizeReportOnRun set to true and to false, with the same result.
What's is wrong?
Thanks.
Set Report Culture With Variable Expression
-
- Posts: 800
- Joined: Tue Sep 07, 2021 10:11 am
Re: Set Report Culture With Variable Expression
Hello,
Please send us a sample report with test data that reproduces the issue.
Thank you.
Please send us a sample report with test data that reproduces the issue.
Thank you.
Re: Set Report Culture With Variable Expression
Hi, thanks for your faster awnser.
Problem exists with sample report with json datasource and 3 columns with 3 rows, and with a complex report with headers, 3 datasources, etc... the problem is not the report, I think... Designer is working, but not the Viewer from PHP.
JS report object needs a method or property set to another value to do the translation before the render?
Thanks
Problem exists with sample report with json datasource and 3 columns with 3 rows, and with a complex report with headers, 3 datasources, etc... the problem is not the report, I think... Designer is working, but not the Viewer from PHP.
JS report object needs a method or property set to another value to do the translation before the render?
Thanks
Re: Set Report Culture With Variable Expression
More info: I'm using Laravel 10. Do the report viewer needs a special route or ignore crsf token?
Re: Set Report Culture With Variable Expression
Hi again.
I have been doing some tests, and I have solved it as follows:
In PHP:
onPrepareVariables event, I fill {CULTURE} variable, but this value does not make it to the report, or does not take it into account, although it is shown in the detail section (????)
In <script> section on viewer:
In this JS block, CULTURE variable not yet have the value of the established culture on PHP onPrepareValues event (???), but if we fill the value now, then it works.
Could be a bug in the onPrepareVariables event???
Thanks
I have been doing some tests, and I have solved it as follows:
In PHP:
onPrepareVariables event, I fill {CULTURE} variable, but this value does not make it to the report, or does not take it into account, although it is shown in the detail section (????)
In <script> section on viewer:
Code: Select all
<script type="text/javascript">
<?php
$handler->renderHtml();
?>
function onBeforeRender(event)
{
var variable = event.report.dictionary.variables.getByName('CULTURE')
console.debug(variable.value); //CULTURE IS NOT SET YET! ???
if (variable) variable.value = "{{$culture}}";
console.debug(variable.value); //CULTURE IS NOW SET AND REPORTS RENDERS SUCCESSFULLY
}
function onLoad() {
<?php
$viewer->renderHtml('viewerContent');
?>
}
</script>
Could be a bug in the onPrepareVariables event???
Thanks
-
- Posts: 800
- Joined: Tue Sep 07, 2021 10:11 am
Re: Set Report Culture With Variable Expression
Hello,
Thank you for the imformation.
We need some time to investigate the issue. We will let you know about the result.
Thank you.
Thank you for the imformation.
We need some time to investigate the issue. We will let you know about the result.
Thank you.