Skip to main content
Solved

Is it possible to make the attribute filter dynamic based on the attributes from the input reader?


daniel.m.getz
Contributor
Forum|alt.badge.img+4

I have a workbench that goes as follows:

  1. Read in attributes from a CSV. The attributes are locations, and
  2. Join those records with a buffer and spatial relator to find potential conflicts near the input location
  3. Write out the records to a PPT file

The input table would look something like this

 

Location 1 | Table Text 1 | Table Text 2

Location 2 | Table Text 1 | Table Text 2

Location 3 | Table Text 1 | Table Text 2

 

And ideally, the final PPT file would look like this:

Title Slide: Location 1

Table Slide: Table Text 1

Table Slide: Table Text 2

Title Slide: Location 2

Table Slide: Table Text 1

Table Slide: Table Text 2

Title Slide: Location 3

Table Slide: Table Text 1

Table Slide: Table Text 2

and so on

 

It's in step 3 that I run into issues. I can't find a way to dynamically filter attributes so that I can write to separate slides like I see in the tutorial. The attribute names aren't fixed, so the Attribute Filter doesn't work, at least not that I can see so far. https://community.safe.com/s/article/getting-started-with-the-powerpoint-writer-tables

 

I think I can get the sorting done, but feeding the separate and unique attributes so that the PPT won't combine everything under one slide has been challenging. Is there a better way to do this? It's possible to separate files with the fanout transformer. But managing 5 or 10 or 20 individual PPTs for each record in the table is a pain.

Best answer by boydfme

Hmmm.... I am wondering if thinking about this in an iterative fashion might be helpful here instead of trying to do multiple adds of the same thing for each location. So rather than doing everything all at once, you set the workbench up with user parameters so that each parameter value can be passed into the filter and powerpointstyler so things adjust as needed.

 

I am thinking there are a couple options?:

  1. Create a Loop customer transformer (resource) and put the attribute filter in and the styler within a custom transformer and basically loop over the number of needed records.
  2. Or, you could break this out using python (pythoncaller) and filter out attributes that way and then use a FMEFunctionCaller to adjust the settings in the PowerPointStylers dynamically. Though, the FMEFunctionCaller can be finicky sometimes....
View original
Did this help you find an answer to your question?

5 replies

daniel.m.getz
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • August 14, 2023

I found a really nasty way to do this. I add a counter to the front, and this allows me to group by count. Because the numbers are always going to be the same, I can use the attribute filter and handle any amount up to 40. Not at all elegant. But it will do up to 40 submitted records at a time. to add more 'capacity', just add more attribute filters and PPT stylers. I hope someone sees this and tells me there's an easier way. But for now, I will be content with 201 PowerPointStylers in my workbench.


boydfme
Contributor
Forum|alt.badge.img+9
  • Contributor
  • Best Answer
  • August 16, 2023

Hmmm.... I am wondering if thinking about this in an iterative fashion might be helpful here instead of trying to do multiple adds of the same thing for each location. So rather than doing everything all at once, you set the workbench up with user parameters so that each parameter value can be passed into the filter and powerpointstyler so things adjust as needed.

 

I am thinking there are a couple options?:

  1. Create a Loop customer transformer (resource) and put the attribute filter in and the styler within a custom transformer and basically loop over the number of needed records.
  2. Or, you could break this out using python (pythoncaller) and filter out attributes that way and then use a FMEFunctionCaller to adjust the settings in the PowerPointStylers dynamically. Though, the FMEFunctionCaller can be finicky sometimes....

tomfriedl
Contributor
Forum|alt.badge.img+13
  • Contributor
  • August 16, 2023

I think you need a table (Excel) to control the workflow. Table like:

ID, StyleOption-1, StyleOption-2, ...

Merge the table (FeatureMerger) and control the PowerPointStyle by the values from the table.


daniel.m.getz
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • August 16, 2023
boydfme wrote:

Hmmm.... I am wondering if thinking about this in an iterative fashion might be helpful here instead of trying to do multiple adds of the same thing for each location. So rather than doing everything all at once, you set the workbench up with user parameters so that each parameter value can be passed into the filter and powerpointstyler so things adjust as needed.

 

I am thinking there are a couple options?:

  1. Create a Loop customer transformer (resource) and put the attribute filter in and the styler within a custom transformer and basically loop over the number of needed records.
  2. Or, you could break this out using python (pythoncaller) and filter out attributes that way and then use a FMEFunctionCaller to adjust the settings in the PowerPointStylers dynamically. Though, the FMEFunctionCaller can be finicky sometimes....

I've been putting it off, but I guess it's time to learn the loop transformer. Thanks for the help.


daniel.m.getz
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • August 16, 2023
tomfriedl wrote:

I think you need a table (Excel) to control the workflow. Table like:

ID, StyleOption-1, StyleOption-2, ...

Merge the table (FeatureMerger) and control the PowerPointStyle by the values from the table.

That's cleaner than what I have now. Thank you.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings