Get variable value in runtime before query string data complete

Stimulsoft Reports.JS discussion
r.polyakov
Posts: 11
Joined: Tue Dec 08, 2020 12:46 pm

Re: Get variable value in runtime before query string data complete

Post by r.polyakov »

HighAley wrote: Fri Dec 18, 2020 10:04 am Hello,

There is an error in your code:

Code: Select all

var a = new Stimulsoft.Report.Components.StiText;
a.name = "**DataSourceSqlCommand**";
a.page = command.report.Pages[0];
var param = Stimulsoft.Report.Engine.StiParser.StiParser.parseTextValue('{users}', a);
The third row should be

Code: Select all

a.page = command.report.pages[0];
Thank you.
Hello.
I have tested the method with
a.page = command.report.pages[0];
but pages is not defined in function StiHelper.prototype.process(). I have checked param pages before jsHelper.send(json, callback) is executed.

Code: Select all

var a = new Stimulsoft.Report.Components.StiText;
a.name = "**DataSourceSqlCommand**";
a.page = command.report.pages[0];
...
jsHelper.send(json, callback);
command.report.pages[0]

Code: Select all

Uncaught TypeError: Cannot read property '0' of undefined
at eval (eval at StiHelper.process (viewer?lotnum=1&report_id=158&file_name=test_applics.mrt&user_id=21:33), <anonymous>:1:21)
at StiHelper.process (viewer?lotnum=1&report_id=158&file_name=test_applics.mrt&user_id=21:47)
at z.viewer.onBeginProcessData (viewer?lotnum=1&report_id=158&file_name=test_applics.mrt&user_id=21:135)
HighAley wrote: Tue Dec 15, 2020 6:58 pm Hello.

We have an assumption about your issue.
We will try to make an improvement for you.

But it's better to see your report template with sample data to be sure that it will work out.

In any case, you need to make changes in the report too.
And it's better to use the expression from the variable in the SQL query.

Thank you.
Can I clarify if you managed to fix anything on this proposal?

Thanks.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Get variable value in runtime before query string data complete

Post by HighAley »

Hello,

We have made an improvement.
The fix will be available in the next build.

We are not sure that your issue will be fixed because we didn't get any real sample from you and can't check the fix.

Thank you.
r.polyakov
Posts: 11
Joined: Tue Dec 08, 2020 12:46 pm

Re: Get variable value in runtime before query string data complete

Post by r.polyakov »

HighAley wrote: Tue Dec 22, 2020 7:05 am Hello,

We have made an improvement.
The fix will be available in the next build.

We are not sure that your issue will be fixed because we didn't get any real sample from you and can't check the fix.

Thank you.

Hello.
Thanks a lot for the fix. Could you tell me what the fix is?
r.polyakov wrote: Fri Dec 18, 2020 8:35 am Hello.
Do you need any more information from me?
Thanks.
I previously asked if more information is needed from me. Can you tell me what format you need the sample data in? Need a dump of the database with the data specified in the mrt file?
Thanks.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Get variable value in runtime before query string data complete

Post by HighAley »

Hello,

The fix is made in our source code.
You should just update to the next build when it is available.

We need any sample (as simple as it's possible) that will let us reproduce the issue.

Thank you.
r.polyakov
Posts: 11
Joined: Tue Dec 08, 2020 12:46 pm

Re: Get variable value in runtime before query string data complete

Post by r.polyakov »

HighAley wrote: Tue Dec 22, 2020 2:58 pm Hello,

The fix is made in our source code.
You should just update to the next build when it is available.

We need any sample (as simple as it's possible) that will let us reproduce the issue.

Thank you.
Hello.
I have created data sample and report.

I managed to get user-entered variable values using command in the StiHelper.prototype.process method.

Code: Select all

let variablesRequest;
let variables = report.getDictionary().fetchVariables();
for (i in variables) {
  let value = report.getDictionary().getVariableValueByName(variables[i].name);
  variablesRequest[variables[i].name] = value;
}
command['variables'] = variablesRequest;
variablesRequest value:

Code: Select all

"variables": {
  "users_pre": [
    1
  ],
  "users": "ANY (COALESCE(NULLIF({users_pre},  ARRAY[]::integer[]), ARRAY[1]))",
  "org": "ANY (COALESCE(NULLIF({org_pre}, ARRAY[]::integer[]), ARRAY[1]))",
  "org_pre": [
    "1"
  ],
  "status": 1  
}
But it only works in user view mode. When I view the report in the designer, this command always returns the default values.

variablesRequest value:

Code: Select all

"variables": {
  "users_pre": null,
  "users": "ANY (COALESCE(NULLIF({users_pre},  ARRAY[]::integer[]), ARRAY[1]))",
  "org": "ANY (COALESCE(NULLIF({org_pre}, ARRAY[]::integer[]), ARRAY[1]))",
  "org_pre": null,
  "status": 0 
}
Could you tell me why this command does not work correctly in design mode?
And could you tell me when the new build with fix will release?
Thanks.
Attachments
database_sample.txt
(2.14 KiB) Downloaded 197 times
test_report1.mrt
(7.83 KiB) Downloaded 176 times
Lech Kulikowski
Posts: 6243
Joined: Tue Mar 20, 2018 5:34 am

Re: Get variable value in runtime before query string data complete

Post by Lech Kulikowski »

Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.
r.polyakov
Posts: 11
Joined: Tue Dec 08, 2020 12:46 pm

Re: Get variable value in runtime before query string data complete

Post by r.polyakov »

Lech Kulikowski wrote: Mon Jan 04, 2021 9:45 pm Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.
Hello!
Please tell me if there is any new on the investigation of the issue?

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Get variable value in runtime before query string data complete

Post by HighAley »

Hello.

The new build is already released.
Please, check it and let us know about the results.

Thank you.
r.polyakov
Posts: 11
Joined: Tue Dec 08, 2020 12:46 pm

Re: Get variable value in runtime before query string data complete

Post by r.polyakov »

HighAley wrote: Mon Jan 18, 2021 2:35 pm Hello.

The new build is already released.
Please, check it and let us know about the results.

Thank you.
Hello.
I have checked getting the values for the request in the new version of the application. An error still occurs when getting values while previewing a report in the designer.
Now, as before, an error occurs in the method Stimulsoft.Report.Engine.StiParser.StiParser.parseTextValue().

Code: Select all

let e = new Stimulsoft.Report.Components.StiText;
e.name = "**DataSourceSqlCommand**";
e.page = report.dictionary.report.pages.getByIndex(0);
for (let i in variables) {
  variablesRequest[variables[i].name] = Stimulsoft.Report.Engine.StiParser.StiParser.parseTextValue("{" + variables[i].name + "}", e)
}
command['variables'] = variablesRequest;
Error
Cannot read property 'stimulsoft' of null

The error occurs in method u.stimulsoft().is(t.Report.Range), which is called in method call_property() from method executeAsm(r). The error occurs due to the fact that in method getVariableValue(e) in parameter this.report, no variables property are defined.
The error only occurs when calling method Stimulsoft.Report.Engine.StiParser.StiParser.parseTextValue() in method designer.onBeginProcessData in designer mode.

Can you tell me how to get the calculated values ​​of variables in the report in the method designer.onBeginProcessData correctly? Maybe I'm doing something wrong.

The main question is how to get the values of the variables in method designer.onBeginProcessData() that are calculated in method invokeConnecting()?
Thanks.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Get variable value in runtime before query string data complete

Post by HighAley »

Hello.

Sorry, our developers can't help with this information.
We need a sample project that will let us reproduce the issue.

Thank you.
Post Reply