Skip to main content

Hi ,

I have been looking
at this article on how to write to microsoft word with FME. I am trying to write out to a table in word. Results are good and I can produce a table like example below.



Application Number
Application Type
Decision


1234
Retention Permission
Granted


1235
Permission
APPLICATION DECLARED


However what my requirements are is to build this table horizontally and then group it by application number. So I would have 1 table per application like below.



Application Number
1234


Application Type
Permission


Decision
Granted




Application Number
1235


Application Type
Permission


Decision
APPLICATION DECLARED INVALID


This is the section in the sample workspace where the table is created from a customer transformer called MSWord table

The table itself is defined from here- I was wondering if anyone knows if its possible to define the table to produce vertical output??

Any ideas would be greatly appreciated.

Hi @ciarab, just an idea....what happens if you set the group by setting of the JSONTemplater to your application?


Hi @ciarab, just an idea....what happens if you set the group by setting of the JSONTemplater to your application?

Using the group by causes workspace to fail but that is because the field headings are trying to be grouped as well as the content where I would only need the content to be grouped.

 

 

I'm sure this is possible to split it out by groups ( I have zero experience with JSON) but I think its feasible that splitting this would work if I sorted the template out.

 

 

What I am really unsure about if it is at all possible to turn the table around to be horizontal, this is what my current output looks like.

 

 

 

 


Hi @ciarab, just an idea....what happens if you set the group by setting of the JSONTemplater to your application?

Hi, I actually think that you will probably need to dive deeper into how the JSON is interpreted and that grouping wont result in pivoting the table.

 

 


Hi, I actually think that you will probably need to dive deeper into how the JSON is interpreted and that grouping wont result in pivoting the table.

 

 

Thanks itay I agree,

 

 

I would need to set some sort of orientation factor in there. But I am unsure if this is even an option. I have tried creating an orientation but I either haven't got the right syntax or maybe this is not even possible. Just wondering if anyone else had an insight on it.

 

 


With a quick look it seems to me the JSONTable templater is only writing a series of sequential information from Templater2. I think I'd start out in that transformer. Make the subtemplate get both the attribute name as well as the attribute value, and set the group-by so it puts each attribute on a separate template. If you turn on breakpoints/debugging you can see what comes out of there and see what I mean.

In general there's two ways of looking at it. Either adjust the workspace to get the vertical layout you want, or flip your data around so it produces data that will achieve the right result with no workspace edits. The first method is the most - righteous, should we say? - but the second method might be quicker.


Just to give a solution to this in case any one ever comes across the same problem as me.

I went with flipping my data around with the attribute exploder so my information is displayed the way I need it to. So I used a counter then an attribute expolder before I send the data into MSWordTable custom transformer and I chose the fields created in the attribute expolder.

Also you can create multiple tables using the custom transformer just use a counter and add the count value in the paragraph sequence

So you end up with an individual table for each feature count.


With a quick look it seems to me the JSONTable templater is only writing a series of sequential information from Templater2. I think I'd start out in that transformer. Make the subtemplate get both the attribute name as well as the attribute value, and set the group-by so it puts each attribute on a separate template. If you turn on breakpoints/debugging you can see what comes out of there and see what I mean.

In general there's two ways of looking at it. Either adjust the workspace to get the vertical layout you want, or flip your data around so it produces data that will achieve the right result with no workspace edits. The first method is the most - righteous, should we say? - but the second method might be quicker.

Thanks Mark when I eventually got back to this your thought process of flipping the data made me think!

 


Reply