Snippet for a row in a table

This forum is for all Flare issues not related to any of the other categories.

Snippet for a row in a table

Postby jkpalmer on Wed Aug 12, 2015 9:58 am

Is it possible to create a snippet for a row in a table?

I see that I will have several tables in my topics. Some of the rows I want to be identical for some of the rows.
Table 1
Code1 Description1 Ref1 (snippet 'Code1')
Code2 Description2 Ref2 (snippet 'Code2')
Code3 Description3 Ref3 (snippet 'Code3')

Table 2
Code1 Description1 Ref1 (snippet 'Code1')
Code2 Description2 Ref2 (snippet 'Code2')
Code4 Description4 Ref4 (snippet 'Code4')

p.s. I am a newbie and have not received any training. Just getting my feet wet.

Jim P.
jkpalmer
Propeller Head
 
Posts: 71
Joined: Tue Jul 14, 2015 9:53 am
Location: Chicago Area

Re: Snippet for a row in a table

Postby doc_guy on Wed Aug 12, 2015 1:40 pm

Jim,

Welcome to the forums!

Yes, you can do this, but it isn't directly supported in the Flare interface.

First you need to understand a bit about how the snippet file is inserted into your topics.

The source code of the snippet files includes the <html> <head> and <body> elements, like any other topic does. However, when Flare generates the content, the content that is BETWEEN the <body> and </body> tags gets taken wholesale and inserted into the Flare target topic.

So, to have a single row from a table in a snippet, what you do is make sure that between the <body> and </body> tags of the snippet you have just the <td> tag (and any child tags) that make the table row. You DON'T want to have the <table> tags in the snippet file because that will insert a new table inside the table.

It isn't valid HTML (because <td> isn't a valid child of <body>), but it works when you generate the output.

Now, in your Flare topic where you want to insert the snippet, you have to insert the snippet in the code view. The easiest way is probably to insert the snippet somewhere else in your topic, and then go into the code view, and 'cut' the snippet code from the first location, and 'paste' it into the middle of the table where you want the row(s) to appear.

It may look weird in the Flare editor, but build your output and it should display properly.

I've used the same idea when I was inserting list items via snippets. The same concepts apply in both cases.
User avatar
doc_guy
Propellus Maximus
 
Posts: 1954
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West

Re: Snippet for a row in a table

Postby ChoccieMuffin on Thu Aug 13, 2015 4:30 am

OOOoooo, what a neat solution!!! Thanks Paul, I had just assumed it wasn't possible. :)
Started as a newbie with Flare 6.1, now using Flare 2019r1.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
ChoccieMuffin
Senior Propellus Maximus
 
Posts: 2171
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Snippet for a row in a table

Postby Dave Lee on Thu Aug 13, 2015 5:16 am

doc_guy wrote:It may look weird in the Flare editor, but build your output and it should display properly.

I've used the same idea when I was inserting list items via snippets. The same concepts apply in both cases.


I know it'll work for lists, but you've had this working with table rows?

I've tried in the past, and tested it again to see if it worked - but I couldn't get it working (in HTML5 or PDF).
I tried:
* Having a snippet with the <td> cells, and inserted it as a block snippet inside a <tr> tag.
* Having a snippet with the <tr> and <td> cells, and inserted it as a block snippet inside a <tbody> tag.
Dave Lee
Master Propellus Maximus
 
Posts: 5676
Joined: Mon Mar 05, 2007 8:33 am
Location: UK

Re: Snippet for a row in a table

Postby emsachs on Thu Aug 13, 2015 11:17 am

I didn't get it to work either - the table lines came out badly. But if you want to put the tables in different topics, you can use snippet conditions. To do this, you would put the whole table in a snippet and then add conditions to each row. You would have a table with four rows:
table
Condition1 Condition2 [tr Description1 Ref1]
Condition1 Condition2 [tr Description2 Ref2]
Condition1 [tr Description3 Ref3]
Condition2 [tr Description4 Ref4]

Then in the topic containing Table1, right-click on a blank area of the topic, open Topic Properties > Snippet Conditions. Set Condition1 to Include, Condition 2 to exclude.

In the topic containing Table2, set Condition1 to exclude, Condition2 to Include

Unfortunately, you cannot do this if you are putting the tables in the same topic.
emsachs
Propeller Head
 
Posts: 91
Joined: Wed Nov 19, 2014 12:49 pm

Re: Snippet for a row in a table

Postby doc_guy on Thu Aug 13, 2015 6:17 pm

Interesting. I was guessing it would work based on how it works for lists. I actually haven't tried it for tables. Sorry about that.
User avatar
doc_guy
Propellus Maximus
 
Posts: 1954
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West

Re: Snippet for a row in a table

Postby cayennep on Fri Jan 29, 2016 5:00 pm

hmm, not able to get this to work

using just the td content, or just the tr content that includes the tds, it breaks in the destination table

The only thing that works is to add the snippets as tables at the bottom of the existing table. However, since some are in the middle of the table, this won't work at all.

Any thoughts appreciated, else will either just use the definition (2nd column) as a snippet, or put all the common table rows into a separate topic
cayennep
Sr. Propeller Head
 
Posts: 365
Joined: Mon Jul 26, 2010 3:42 pm

Re: Snippet for a row in a table

Postby Daniel Ferguson on Mon Feb 01, 2016 6:13 pm

A possible alternative to the method that Paul described above would be to create snippets for the content for each cell of a row rather than a snippet for an entire row itself. It results in a lot more snippets, but it would work. In this case, you would build the entire table structure in the topic, and then insert the snippets into each cell.
Daniel Ferguson
Certified Flare Trainer & Consultant
smartoutput.com
Daniel Ferguson
Propeller Head
 
Posts: 77
Joined: Wed Jul 10, 2013 12:34 pm
Location: Salt Lake City

Re: Snippet for a row in a table

Postby cayennep on Wed Mar 30, 2016 10:07 am

Still an issue, years later, even with the 'new, improved' snippet features.

bummer. I can leave the snippet as a paragraph, but don't really want the <p> tag in the table. I could also make a <p> style that matches the table, use that in the snippets - but extra steps, and still don't want the <p> tag in the table.

Anybody find any fixes for this? Else will have to live with applying a <p> style that matches the table style and just live with <p> tags in tables.
cayennep
Sr. Propeller Head
 
Posts: 365
Joined: Mon Jul 26, 2010 3:42 pm

Re: Snippet for a row in a table

Postby [+][Josh][+] on Thu Mar 01, 2018 8:00 am

(Two years later...) Is there now a better solution for combining table rows as snippets?
I'm writing application parameters in a table, many of which are reused for different applications (targets).
Currently I have many conditions on each row, to select the rows that fit each target, but this is not scalable, and is prone to error.
[+][Josh][+]
Jr. Propeller Head
 
Posts: 1
Joined: Tue Apr 24, 2012 11:01 pm

Re: Snippet for a row in a table

Postby Xonk on Tue Aug 13, 2019 3:28 am

(Now 3 years later) Any better solution, for combining table rows as a snippit?
Xonk
Jr. Propeller Head
 
Posts: 6
Joined: Fri Jul 12, 2019 3:01 am


Return to Flare's General Discussion

Who is online

Users browsing this forum: No registered users and 5 guests