Impossible to delete blank line in generated word with template - ms-word

I'm currently using m2doc for my Capella project and when I launch the generatio of the docuement with the template that I have created some lines in my tables are empty and they are not deleted.
Example :
test | test | test
| |
file | file | file
I'm currently using Acceleo in my template to retrieve the information in my Capella diagrams. But I don't know how to delete this empty lines in the table which are useless for me.
Example of my code :
{ m:if ports.name.contains('LOC')}
So I need your help to delete this empty lines in my table.
Thank you.
Regards,
Marc

If you insert your table using asTable*() from Sirius services, the table is an instance of the Java type MTable.
You can write a Java service that take a MTable as parameter and check for MRow without any MCell in it. If the MRaw is empty remove it from the table and return the table.

Related

JSReport -- working with docxChild. I can't resolve the error : "docxChild helper requires asset parameter to be set"

I'm trying many functionality on jsReport and word and got stuck on this one.
I want to create an asset usable in different template, assuming that my asset got the right data.
Using this documentation and the UI jsReport Studio I create a working template called test-word, I upload a docx test_jsReport.docx with some ahnddlebar in it, create some data and it work.
Then I create an asset, in the same folder, with a second docx test_jsReport2.docx ; put some code and try to generate it alone with the same data, it worked again.
At this point my project look like this :
test project
Then, using this chapter I add in my docx test_jsReport.docx the following code : {{docxChild "test_jsReport2.docx"}}.
So I can no longer run my report, the error is the following.
Report "test-word" render failed.
Error while executing docx recipe
(because) error when evaluating engine handlebars for template anonymous
(because) "docxChild" helper call failed
(because) docxChild helper requires asset parameter to be set
(system-helpers.js line 706:11)
704 |
705 | if (assetNamePathOrObject == null) {
> 706 | throw new Error('docxChild helper requires asset parameter to be set')
| ^
707 | }
708 |
709 | const docxChildInfo = {}
What is that aset parameter that I need to set ? And how to do it ?
I'm pretty sure that I should omehow declare some kind of link beween my two reports, but I can't find how to do that.
First I tried to use the asset property in jsReport studio on my report, like this :
first try
But it doesn't worked and I never really believe it, I think it's an option to define a link to the physical docx I modify, so I don't have to upload after each save.
Second I read and try to mimic some other systems I can find in the doc like this and that and but it's for HTML report not word.
Lastly I tried to reference my report using a script like this :
const jsreport = require('jsreport-proxy')
// Use the "beforeRender" or "afterRender" hook
// to manipulate and control the report generation
async function beforeRender (req, res) {
await jsreport.assets.registerHelpers('test_jsReport2.js')
}
It doesn't work either.
I'm a little lost here, what is the right way to use docxChild ?
Here is a link to an example of what I do : https://playground.jsreport.net/w/anon/Pm_vIEwF
Here is how I setup the example :
I prepared my two word
Right click > new entity > template
Select handdlebars and docx > next > next
Click on my template > in properties, in docx I upload my main.docx
Right click > new entity > asset > upload, i put my subreport.docx
The docxChild feature works by searching a docx asset and take the content of such docx and insert it into the docx it was called from. You have follow the right steps, but the only issue is that you are using different characters for the quotes in your docxChild helper call. It was perhaps not your intention, for example on macos i noticed that whenever i try to use " it replace it for the characters present in your docx, so maybe if you are using macos this is the problem you are having.
Your original template
What should look like to have it working
I've prepared a playground example with your same code but fixing the docxChild call to use the right quote characters "",

How to delete a referenced file?

In an 6.2.26 installation we have the following problem:
an editor wants to delete a file, which is not used any more.
if I click on the delete icon I primary get the warning about 3 references while in the list only 2 are shown:
if I agree I get the error message:
Trying to identify the problem in the database results in strange findings.
The data is no straight include but a two level IRRE construct (#1) and there once were workspaces installed (meanwhile removed)
so there are two references shown in the file list module we can only find one reference (or two references in case of the file with the shown four references)
the mm-records are deleted (deleted = 1) and show usage of workspaces (t3ver_id = 1, t3ver_label = 'First draft version')
after removing of these records and following cleanup-task (Dateiabstraktionsschicht: Speicherindex aktualisieren (scheduler)) there were no differences in the list or count of the references
How can we cleanup the database?
how can the editor delete the file?
(#1)
tt_content
+-(IRRE)-> tx_downloadlinks_domain_model_downloadbox
+-(IRRE)-> tx_downloadlinks_domain_model_links
+-> sys_file_references
+-> sys_file
These are probably references in sys_ref. Try to update the sys_ref table. Is one of the low-level cli commands

Connecting cleansing components to tFileList - Talend

What is the best way to apply logic to objects during an iteration of tFileList.
The issue is that if I use a tFileList to get a list of files, i am not able to use tJavaRow or jMap to create the filename that i want the file to be renamed. Basically, if i have zip files with years(2010,2011,2012 etc) and each zip file contains files with the same name (f1.csv, f2.csv, f3.csv), i want to iterate through the compressed files, uncompress them and rename the files with
f1_2010.csv, f2_2010.csv, f3_2010.csv..f1_2012.csv etc.
Thanks!
Iterate links are providing a way to execute components based on events or facts while main links are transfering data between components.
With something looking like that you should be able to resolve your problem :
tFileList_1 --iterate--> tFileUnarchive_1
|
onComponentOK
|
tFileList_2 -- iterate --> tFileCopy_1
|
onComponentOK
|
tFileArchive_1
Use ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")) in your tFileUnarchive to get the ZIP path.
In tFileCopy use ((String)globalMap.get("tFileList_2_CURRENT_FILEPATH")) to get the path of file and config it to be a rename.
For your name modification you can add tJava on "onComponentOK" links. By using globalMap.put("year",((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")).substring(x,x)) or more complicated code. And use these variables in your others components parameters.

Manipulate PDF via SQL

what I want to do is automatically create PDFs with data from SQL Server 2008 R2. After creation a string shall be added in the first line of the file. This "header" has to be clear text (right click PDF -> edit -> write string in the first line) and therefore can't be added in the pdf-creation process. The codes in the header are beeing used by another job for further processing.
Is there a way to do that via SQL?
Sample data looks like:
Name | Date | Time | Place | Appointment
John Doe |2014-09-15| 11:00 | Narnia | 12:30
I already found ways to create the PDF, using SSRS and subscription or the procedure mentioned here: http://www.sqlservercentral.com/articles/Miscellaneous/creatingapdffromastoredprocedure/1104/
But I wasn't able to write text to first line, just appended it at the end of the file.
Any help is much appreciated!
This can not be done in SQL. There are a few options that I now of that you can look into to see if it will suite your needs.
NOTE : These are not trivial tasks.
Implement your own device renderer, falling back on the default pdf render.
Override the built in pdf renderer to add your custom header.
Use the SSRS web service api and implement the Render method allowing the access to the Pdf as byte[] and further manipulate it to your needs.
The 3rd method would be the most straightforward and ideal method and would work in both web and windows apps.

Entity Framework: Each type name in a schema must be unique

I'm doing a very non-standard build of Entity Framework. I've used EdmGen2 to generate edmx off of a db, and split the component csdl, msdl and ssdl files into their own files. The metadata in the connection string to them looks like this:
C:\Downloads\EDM | filename.csdl | filename.msdl | filename.ssdl
I have a unit test that does nothing but try to open the connection, and I get this error (along with a lot of other chaff):
"Each type name in a schema must be unique"
If I go into the csdl manually and add a "1" to the names, it eventually moves onto the msdl file and starts complaining about it. Clearly, somehow the schema is getting double-defined in the open operation...
There is no reference to the edmx in the test or dependent project. In fact, there are no references to any of those, as this is a project for generating all this stuff dynamically at run-time.
I've seen the Julie Lehrman / Don't Be Iffy post, and it doesn't appear to be that problem.
TIA...
Figured it out...the Metadata workspace is apparently hard coded to look for the three files (which makes sense), and when I removed the directory specification in the metadata tag, it all started working. My metadata attribute now looks like this:
C:\Downloads\filename.csdl | C:\Downloads\filename.msdl | C:\Downloads\filename.ssdl
So I think it's an either / or proposition: either specify the directory where the files are located, or the individual file locations.