Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9002483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:34:37+00:00 2026-06-16T00:34:37+00:00

I have a template which uses the same multivalued attribute in various places. I

  • 0

I have a template which uses the same multivalued attribute in various places. I often find myself in a situation where I would like to filter the attribute before a template is applied to the individual values.

I can do this:

<#col:{c|<if(cond)><# c.Attribute2 #><endif>};separator=\",\"#>

but that is not what I want, because then there are separators in the output separating “skipped” entries, like:

2,4,,,6,,4,5,,

I can modify it to

<#col:{c|<if(c.Attribute1)><# c.Attribute2 #>,<endif>};separator=\"\"#>

Which is almost OK, but I get an additional separator after the last number, which sometimes does not matter (usually when the separator is whitespace), but sometimes does:

2,4,6,4,5,

I sometimes end up doing:

<#first(col):{c|<if(cond)><# c.Attribute2 #><endif>};separator=\"\"#>
<#rest(col):{c|<if(cond)>,<# c.Attribute2 #><endif>};separator=\"\"#>

But this approach fails if the first member does not satisfy the condition, then there is an extra separator in the beginning:

,2,4,6,4,5

Can someone give me a better solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:34:38+00:00Added an answer on June 16, 2026 at 12:34 am

    First, let me point out that I think you are trying to do logic inside your template. Any time you hear things like “filter my list according to some condition based upon the data” it might be time to compute that filtered list in the model and then push it in. That said something like this might work where we filter the list first:

    <col:{c | <if(c.cond)>c<endif>}:{c2 | <c2.c.attribute>}>
    

    c2.c accesses the c parameter from the first application

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file template.txt which contains the following: Hello ${something} I would like
I have an jquery ajax success function which uses a template to put json
I have a small I have just written which uses the following uri template.
I have an ASP.Net web page, which uses a Master Page template. The page
We have a problem using a class template which itself uses function objects in
I have a ControlTemplate which uses the same color in multiple elements. On certain
I have a load of php templates which uses a custom translate function __,
I have template in which a button is created with a link using css,
Say I have a template which displays a view based on a property: {{#if
I am migrating application from JSF1.2/MyFaces+Facelets TO JSF2.1/MyFaces. I have following template which used

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.