Create a Snippet from a Table

This forum is for all Flare related Tips and Tricks.
Have a tip or trick you use while working in Flare? Share it here.
Post Reply
Adrian Durand
Propeller Head
Posts: 75
Joined: Fri Feb 17, 2006 6:33 am
Location: Midlands, UK

Create a Snippet from a Table

Post by Adrian Durand »

Hi All,

Is it possible to create a snippet from part of a table?

I have a formatted table with 2 columns and 2 rows that I want to make into a snippet, but when it is highlighted, the Format - Create Snippet option is greyed out. As I will be using this multiple times, a snippet seemed to be the easiest way to go, but it appears that I may be missing a step.

Your thoughts would be appreciated.

Adrian

Edit: Sorry, Flare V4
KevinDAmery
Propellus Maximus
Posts: 1985
Joined: Tue Jan 23, 2007 8:18 am
Location: Darn, I knew I was around here somewhere...

Re: Create a Snippet from a Table

Post by KevinDAmery »

I haven't had a chance to try this out, but it may be worth testing.

1) Create a two row, two column table
2) Add the content you need into the appropriate cells
3) Turn the entire table into a snippet
4) Open the snippet in the text editor of your choice (so you can see the html code)
5) Remove the <table> and </table> tags
6) Save the snippet

Hopefully, you should be able to insert the snippet into a table and have it work, although you may have to do some surgery on the code there as well to make sure that it is not contained within any tr or td tags.

This is more manual than I'd like, but hopefully it will work. If you would prefer something more streamlined, I would submit a feature enhancement request: you can submit one here:

http://www.madcapsoftware.com/bugs/submit.aspx
Until next time....
Image
Kevin Amery
Certified MAD for Flare
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Create a Snippet from a Table

Post by LTinker68 »

Adrian Durand wrote:I have a formatted table with 2 columns and 2 rows that I want to make into a snippet, but when it is highlighted, the Format - Create Snippet option is greyed out. As I will be using this multiple times, a snippet seemed to be the easiest way to go, but it appears that I may be missing a step.
You could always select the table, copy it, deselect the table, go to Format > Create Snippet to create a new snippet file, then paste the table into that snippet file.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
Adrian Durand
Propeller Head
Posts: 75
Joined: Fri Feb 17, 2006 6:33 am
Location: Midlands, UK

Re: Create a Snippet from a Table

Post by Adrian Durand »

Hi Kevin, Lisa,

Thanks for the replies.

It had been a long day after the weekend, and it did't even occur to me to create a dummy snippet then just paste the table in :?

Thanks to you both.

Adrian
ChuckJulian
Propeller Head
Posts: 14
Joined: Tue Sep 09, 2008 3:40 pm
Location: Penacook, New Hampshire

Re: Create a Snippet from a Table

Post by ChuckJulian »

Hi, Folks. Thanks for the assistance on the day I was struggling with this issue. :(

Suggestion/reminder: Neither the topic editor nor the snippet editor are WSSIWYG. Even clicking the "Preview compiled topic" button displayed a messed up snippet. I though I had made the snippet incorrectly. Even inserting the snippet into my topic didn't display properly. Only after I Previewed or Built the final topic did it look right.

The Flare editor has a way to go yet. I'm thankful for this forum. :P

Chuck
Chuck Julian
owenf
Propeller Head
Posts: 48
Joined: Tue Sep 01, 2009 3:41 am

Re: Create a Snippet from a Table

Post by owenf »

(Flare 7) i'm trying to create snippets from table rows... doesn't work. tried the manual editing way suggested higher up the thread. nope. you can create the snippet but Flare throws a wobbly, because you're _supposed_ to have <tr> nested inside <table>. i think the parser could probably be a little more lenient in the case of snippets - ideally i'd only want it to throw if there was invalid markup after the whole topic was assembled. this particular omission seems to go against the grain of this amazingly flexible software... it seems to me that building different tables out of different subsets of the same set of rows is a very obvious use case for snippets.

owen
Msquared
Propellus Maximus
Posts: 848
Joined: Mon Aug 06, 2012 10:19 am
Location: Southampton, UK

Re: Create a Snippet from a Table

Post by Msquared »

I've just found this thread (I'm a bit behind the times, I know).

Like Owenf, I'm also trying to create a snippet from several adjacent rows in a table, which are repeated in many tables. I can then place the snippet in other tables as a group of rows where necessary, and update in one place as required, and save myself lots of work making fiddly updates in over 40 tables. This also seems a useful single-sourcing feature to me.

Like KevinDAmery, I tried hacking both the snippet XML and the table XML to see if I could coax Flare 8 to let me make the snippet and insert it. I even tried hand-coding inserting as a SnippetBlock and as SnippetText (the two ways Flare can insert snippets).

Not a hope! Did anyone manage to work out a way to get this to work?
Marjorie

My goal in life is to be as good a person as my dogs already think I am.
Terence
Jr. Propeller Head
Posts: 8
Joined: Mon May 06, 2013 7:57 am

Re: Create a Snippet from a Table

Post by Terence »

Hi, I have the same problem and found this thread after some searching.

I have several table rows that are repeated multiple times through my project. I imagine that these rows would make good snippets, but I can't seem to get them to be inserted properly as snippets.

Is there a way to do this now? Or is there a workaround, such as making separate table cells into individual snippets (which would be tedious but still at least somewhat easier to maintain than keeping everything in text).
Msquared
Propellus Maximus
Posts: 848
Joined: Mon Aug 06, 2012 10:19 am
Location: Southampton, UK

Re: Create a Snippet from a Table

Post by Msquared »

I've not managed to work round this yet. This seems exactly the sort of thing you may want to do when single sourcing content and I'm quite surprised that it isn't supported.

I've submitted a feature request. I suggest you submit a feature request too, Terence. The more people that ask for it, the more likely we are to get it.

I have about six common rows that are repeated in over 40 tables, as well as many other individual rows that appear in several tables each. I've recently done a manual exercise to ensure that each duplicated row contains the same information in each table that it appears in, because one of our major customers complained that the content was inconsistent. It took me days, and even now, I still get the odd inconsistency reported. :-(
Marjorie

My goal in life is to be as good a person as my dogs already think I am.
CATERAF
Sr. Propeller Head
Posts: 103
Joined: Mon Mar 18, 2013 10:19 pm
Location: Perth, Australia

Re: Create a Snippet from a Table

Post by CATERAF »

I also have this problem. I am trying to take one column and then paste it into another table using a snippet. It inserts the snippet happily enough but it inserts it as a block rather than individual table rows. This means I can't differentiate rows in the pasted table; a real problem!

I did just notice that if you want the snippet table rows to line up with the actual table rows you can get it to do this by:
1). Generate as many new rows as there are table rows in the snippet.
2). Merge all the cells in the column where you want to add the snippet
3). Paste the snippet

The unfortunate part of this workaround is that if you change the number of rows in your snippet, your tables don't change to reflect that..
Don Barwick
Propeller Head
Posts: 11
Joined: Wed Feb 03, 2016 5:22 am
Location: England, UK

Re: Create a Snippet from a Table

Post by Don Barwick »

I also wanted to use snippets for table rows. I have submitted a feature request; let's see if it bears fruit.
Paul Griffiths
Sr. Propeller Head
Posts: 261
Joined: Wed Apr 18, 2007 2:25 am
Location: Nottingham, UK

Re: Create a Snippet from a Table

Post by Paul Griffiths »

I had to do something similar, and the way I did it was to make the rows that I wanted as snippets as a table with just a tbody.

Now it depends on how you format your tables, but I my situation I was simply able to:

table (with thead) and rows.
table snippet here
table (optionally with tfoot) and more rows

So really it's three tables one after another, but it looked like one.

The trick was to make sure the columns of the tables are all the same, which you can do by defining col classes with width attributes.

HTH YMMV
Post Reply