Loading...
 
Features / Usability

Features / Usability


Pretty tracker: How to hide empty fields - conditional display

posts: 43

Suppose you have a tracker where some fields aren't filled in, like

Name: me
Occupation: Tiki developer
Website:

In this case the field 'website' is left empty.
Is it possible to hide the last row completely in the pretty tracker page? Not just the empty field, but also the row label?
So that the pretty tracker would only display

Name: me
Occupation: Tiki developer
posts: 92

I am very interested in the answer to the original question. However, 2+ years, 571 reads and no answers....I won't hold my breath.

My use case is for reference materials that can be books, magazines, paintings, drawings, etc. I didn't want a single field with a delimiter between each person that should have credit. I couldn't find a better way using trackers, so I created 3 places (hopefully I never need 4). And for each I can specify a role (item link to another table with values: author, editor, illustrator, artist, draftsperson, designer, etc)

These are the relevant fields only:
115 = credit #1
116 = credit type credit #1
117 = credit #2
118 = credit type credit #2
119 = credit #3
120 = credit type credit #3

The wiki template for the pretty tracker looks something like this

{FANCYTABLE(colwidths=100%)} {$f_115}({$f_116}); {$f_117}({$f_118}); {$f_119}({$f_120}) {FANCYTABLE}

So, there won't always be a 2nd or 3rd credit, and if the object is a book and all are authors, I'd like to be able to leave the type field blank and not be displayed.

Now I get something like this if I fill in the type field for the first two author:

Bluenose
Backman, Brian (author); Backman, Phil (author); ()
McClelland and Stewart, Limited, 1966

where I would like to have this, when the fields are blank. Notice the first two author types are not displayed, and nothing is displayed for the 3rd author:

Bluenose
Backman, Brian; Backman, Phil
McClelland and Stewart, Limited, 1966

I have the same thing with identifiers like ISBN. I have 3 holders for type (ISBN-10, ISBN-13, etc.). But often only one is filled out. I want to hide the empty cells as with the credits.

Note: I know how to link SQL tables to avoid all these blanks, but I could not figure out how to do it with trackers.

Well, here's to hoping someone has a good answer! Thank you for your time!!!



posts: 92

Thanks. But I must be doing something wrong. Could someone post an example of how to reference the itemID in a wiki template page?

I tried this, but I get the same result no matter what:

Copy to clipboard
{TRACKERITEMFIELD(itemID=$itemId, fieldId=117 test=1)}Second author set{ELSE}Just one author{TRACKERITEMFIELD}


I also tried it without the $, but that did not help:

Copy to clipboard
{TRACKERITEMFIELD(itemID=itemId, fieldId=117 test=1)}Second author set{ELSE}Just one author{TRACKERITEMFIELD}

posts: 92

I thought I had found the solution here:
http://comments.gmane.org/gmane.comp.cms.tiki.user/3629

But I have several fields that I want to put in a table, and on one row. If I put more than one if-else block on the same line (no carriage return), there is a syntax error reported.
This is true if the code is outside the table (as shown) or inside the table, with each one separated by a comma for different columns. (note: I don't know the 1st thing about smarty syntax)

Copy to clipboard
{if $f_115 eq '' }{else}{$f_115}{/if} {if $f_116 eq '' }{else} ({$f_116}){/if} {if $f_117 eq '' }{else}{$f_117}{/if} {if $f_118 eq '' }{else} ({$f_118}){/if} {if $f_119 eq '' }{else}{$f_119}{/if} {if $f_120 eq '' }{else} ({$f_120}){/if} {FANCYTABLE(colwidths=100%)} {DIV(type="span" class="reference_title")}{$f_128}{DIV} {$f_113},{$f_114} {BUTTON(href="Home" _text="Add To My Library")}{BUTTON} {FANCYTABLE}


posts: 92

Likewise, I cannot do this

Copy to clipboard
{IMG src="img/icons/pencil.png" link="Edit+Reference+Edition&itemId=$f_itemId"}


I wanted to create a link icon for each entry, rather than having linked text. Primary reason for this is that if the field is an item link it will link the the item in the other tracker. Otherwise it links to the item in this tracker. It is not obvious, and is therefore confusing to the user.

I'm still hoping that there is something I am missing that will allow me to reference the itemId from within a plugin.