May 13th, 2009, 8:14 PM
Hey Steven,
Yes, both are definitely possible, but may take some fiddling.
1. I don't quite follow exactly what you need, I must admit. I get the general gist, but the details escape me. You can't reference a specific value within the variables passed to the template unless you know exactly where the value is (row + column) within the var - which is probably unlikely, since the contents are dependant on the current form, View, search criteria and order.
What you might want to try is looping through the $submission var TWICE - the first time extracting whatever value you want based on your criteria. e.g. this grabs the first value in the "X" column:
2. Depending on your data set, this may be simpler. What you could do is again put multiple loops through the $submissions var, omitting results in each data set that don't match a particular criteria.
Sorry, it's really tricky to give helpful advice on both of these question - this is something that really needs to be played around with directly.
- Ben
Yes, both are definitely possible, but may take some fiddling.
1. I don't quite follow exactly what you need, I must admit. I get the general gist, but the details escape me. You can't reference a specific value within the variables passed to the template unless you know exactly where the value is (row + column) within the var - which is probably unlikely, since the contents are dependant on the current form, View, search criteria and order.
What you might want to try is looping through the $submission var TWICE - the first time extracting whatever value you want based on your criteria. e.g. this grabs the first value in the "X" column:
Code:
{assign var=my_val value=""}
{foreach from=$submissions item=submission name=row}
{foreach from=$display_fields item=field name=col_row}
{assign var=col_name value=$field.col_name}
{assign var=value value=$submission.$col_name}
{* if this is column X, grab the value *}
{if $my_val == "" && col_name == "X"}
{assign var=my_val value=$value}
{/if}
{/foreach}
{/foreach}
{* this outputs the value *}
{$my_val}
2. Depending on your data set, this may be simpler. What you could do is again put multiple loops through the $submissions var, omitting results in each data set that don't match a particular criteria.
Sorry, it's really tricky to give helpful advice on both of these question - this is something that really needs to be played around with directly.
- Ben