Thanks for the reply, I suspected so but thought it was worth asking.
Posts made by Adam Richards
-
RE: Chrome-PDF page break on split page table rows?
-
Chrome-PDF page break on split page table rows?
I've tried reading the chrome-pdf docs and what I can find about headless Chrome, but I can't find what I'm looking for. I'm trying to find a way to make chrome-pdf document rendering to force page breaks if a <tr> splits onto two pages.
I know this is probably very difficult, if possible at all, as the size of the page and the content in it aren't necessarily known until after it's rendered. But does anyone know if there's a way? It would just make the output of my documents (which are heavily table-reliant) look cleaner.
-
RE: Local install of JSReport crashed - now won't start
I'm removed it and get the same error.
-
RE: Local install of JSReport crashed - now won't start
which jsreport folder will the data folder be in? I'm not overly familiar with the structure.
-
RE: Local install of JSReport crashed - now won't start
I'm on 2.1.0, but I can't find that file to delete?
-
Local install of JSReport crashed - now won't start
As the title says, I have a local install that I've been experimenting with, and it's been working fine. I was working on trying to get some external data with scripts, when my computer crashed (blue screen - Windows 10). Once it did the disk scan and repair, I tried to load jsreport again from the command line and get this error each time.
2018-07-18T10:46:37.907Z - info: Using extension public-templates 2018-07-18T10:46:37.918Z - debug: Extension public-templates was disabled 2018-07-18T10:46:37.927Z - info: fs store is persisting using fs 2018-07-18T10:46:37.929Z - info: fs store is synchronizing using fs 2018-07-18T10:46:38.019Z - info: fs store is loading data 2018-07-18T10:46:38.095Z - error: Error occured during reporter init SyntaxError: Unexpected token in JSON at position 0 at JSON.parse (<anonymous>) at parse (C:\Users\ar206747\node_modules\jsreport-fs-store\lib\customUtils.js:77:15) at Array.map (<anonymous>) at loadFlatDocument (C:\Users\ar206747\node_modules\jsreport-fs-store\lib\persistence.js:148:58) at <anonymous> An error has occurred when trying to initialize jsreport (2). Unexpected token in JSON at position 0 (1). caused by error (2) -> stack = Error: at instance.init.then.catch (C:\Users\ar206747\node_modules\jsreport-cli\lib\instanceHandler.js:31:29) at <anonymous> caused by error (1) -> stack = SyntaxError: at JSON.parse (<anonymous>) at parse (C:\Users\ar206747\node_modules\jsreport-fs-store\lib\customUtils.js:77:15) at Array.map (<anonymous>) at loadFlatDocument (C:\Users\ar206747\node_modules\jsreport-fs-store\lib\persistence.js:148:58) at <anonymous>
The odd thing is the error it's reporting about unexpected token in json at <anonymous> is the problem I was trying to debug in my script when the computer crashed.
I've tried
jsreport repair
but it hasn't fixed the problem.Any ideas?
-
RE: Using multiple data sources in a single template?
Ignore that, I fixed it by changing
{{each $resource.modules.modules}}
to{{each ../$resource.modules.modules}}
. I didn't realise that I'd have to be that explicit when using $resource. -
RE: Using multiple data sources in a single template?
Thanks, it really does. The problem I'm having now is that when I try to each loop with a different resource as the source the nested loop, nothing happens.
<tr> <td>{{#each $resource.course.Modules}} {{this.[Module Code]}} {{#each $resource.modules.modules}} <p>1</p> {{/each}} {{/each}} </td> </tr>
The
<p>1</p>
is in there for my own testing. it never gets printed/output, like the inner loop just isn't happening. -
RE: Using multiple data sources in a single template?
Hi, thanks, yes I got that working now.
If I can be a pain and ask, is it possible to iterate over two nest each loops to match data in the two sources? As per my original idea.
So I have a data source called course, which has a list of associated modules, held in array, with an identifier 'modulecode'. I have a second data source called modules which have the same 'modulecode' identifier, but then extended information like name, duration etc.
What l'd like to do is to step over each module code in courses, then loop over the array of modules and output the name for example on a match. Is it possible?
I understand that for each loop of the each, I can refer to the current record as 'this.', but what happens when it's nested? I need the equivalent of this pseudocode:
{{#each $resource.course.module}} <p>Module {{8}}: </p> {{#each $resource.modules.modules}} {{#if this.modulecode **meaning the modules data source** == parent.modulecode **is there a concept of parent for nests?**}} {{this.modulename}} {{/if}} {{/each}} {{/each}}
Does that make sense? Is it achievable without merging the datasets? Is it using @root as above?
-
RE: Using multiple data sources in a single template?
I just wanted to update to say I think the problem must be in my template somewhere, and I don't know where. I copied the HTML out to a new template, didn't choose a data source and set the resources up the same way and it works. It seems that it didn't like having a data source chosen and then removed?
-
RE: Using multiple data sources in a single template?
Out of interest, should I be able to accomplish this with Resources extension? I've installed it, it lets me choose which data sources I want, but using the notation
{{$resource.course.CourseName}}
I still get the error. I get the error in the reply above whenever I don't choose a data source from the drop-down in the studio. -
RE: Using multiple data sources in a single template?
Should it work if I don't assign a data source in the studio? I'm happy to upload my code/etc if you let me know the easiest and best way to do it, but as soon as I deselect a data source in the studio, it falls over with the
Error: template input in request contain values that does not match the defined schema. schema validation errors: template.data should be object
error, even with nothing included in the template. -
RE: Using multiple data sources in a single template?
Thanks for this reply, I think i understand a little better. I can't test it yet though, as the JS I used from above seems to be tripping me up. If I change my data source in the studio and remove any handlebars in my template and try to run it, I get this error:
Error while executing templating engine. Unable to find module jsreport-proxy Searched paths: jsreport-proxy jsreport-proxy C:\Users\ar206747\jsreport-proxy C:\Users\ar206747\jsreport-proxy C:\Users\ar206747\node_modules\jsreport-cli\lib\jsreport-proxy . > 1 | const jsreport = require('jsreport-proxy');
Is it possible I don't have jsreport-proxy installed, and if so, how would I get it? As far as I know I did a complete normal npm install of jsreport.
Edit: I fixed the above problem by copying jsreportProxy.js to \jsreport-cli\lib (is that a bug needs reporting, or my bad installation/config?). I'll try working some code in now and see how I get on.
-
RE: Using multiple data sources in a single template?
Thanks for this. I'm really a novice, so does this mean I could reference it like this?
{{#each data1.code}} <p>Record {{data1.name}} contains the following units:</p> {{#each data2.code}} {{#if data2.code == data1.code}} <p>{{data2.name}}</p> {{/if}} {{/each}} {{/each}}
So that in theory would cycle through each unique code/identifier in data1, look for a match for each in data2, and then output the 'name' field from each record in data2 where the code matched the code in data1.
Am I on the right track? Would I be able to reference those two data assets the way I think, with data1. and data2.?
(edit: I'm getting an error telling me jsreport-proxy isn't there -
Error while executing templating engine. Unable to find module jsreport-proxy
)(edit 2: by changing to camel notation and requiring jsreportProxy I got past that error, but now I get an error
template input in request contain values that does not match the defined schema. schema validation errors: template.data should be object
which makes me think I'm trying to get the data in my template doesn't work the way I guessed at above) -
RE: Using multiple data sources in a single template?
Thanks for the reply. What about when both data sources are json files in the studio, is it still possible?
-
Using multiple data sources in a single template?
I've managed to figure out a lot of things in the week I've been learning jsreport, but I can't figure out how to access multiple data sources in a single report.
I can choose a single data source for my template, but I really want to drill down to a second data source for my report to pull related data. I have a key in both sets of data for looking up, but no idea how to access the secondary data.
Can anyone help? Am I missing something simple?