0

I'm trying to work out how this is done, it seems the standard templates have this coded in

{$l}if $sections.{$column}.type & 4{$r}
                    {$l}assign var=printValue value=$row.{$column}|crmDate{$r}
                {$l}elseif $sections.{$column}.type eq 1024{$r}
                    {$l}assign var=printValue value=$row.{$column}|crmMoney{$r}
                {$l}else{$r}
                    {$l}assign var=printValue value=$row.{$column}{$r}
                {$l}/if{$r}
                {$l}if $rowid neq 0{$r}
                  {if $section.pageBreak}
                    {$l}if $pageBroke >= {$h} or $pageBroke == 0{$r}

And I know the extended reports extension implements this.

I have been looking at the code, but it is very generic, in that it allows selecting sort fields & selecting section / page breaks. But I can't yet fathom out what I need for my simple use case ( I don't need user selectable option - just want to break on a sort field )

I'm hoping it is something straight forward $this->_sections but I am floundering around a bit.

$this->assign('sections', $this->_sections);

Any help or pointers to example much appreciated.

--- edit --- this is where I have got to

function orderBy() {  $this->_orderBy = "ORDER BY mycolumn";

                  $sections = array ( 'my_section' => array (
                  'title' => 'My Name',
                  'type' => 2,
                  'tplField' => 'mytable_mycolumn',
                  'section' => 1,
                  'pageBreak' => 1,
                  ));

                  $this->assign('sections', $sections);

                 }

Whilst it is promising, in that it puts out the at least the text of the first section and it doesn't fail or shout warnings, it just doesn't present any values?

I have tried combinations of mytable_myfield / myfield in tplField and columns.

I have compared smarty debug variables between working versions and mine, and I haven't got it yet.

  • Any one with a bit more experience in smarty templates help here? Trying to understand the basics of teh template section header loop in report/form/layout/Table.tpl but right now struggling slightly – Alan Fuller Sep 26 '16 at 8:30
1

OK for others searching this is what I found works

 $sections = array ( 'mybreakcolumn' => array (
                  'title' => 'Rep Name',
                  'type' => 2,
                  'section' => 1,
                  'pageBreak' => 1,
                  ));

                  $this->assign('sections', $sections);

Where mybreakcolum is the full column name sent to the template

| improve this answer | |
  • Thanks very much for following up and answering your own question! This just helped me out. – Eli Lisseck Aug 21 '17 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.