IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Topic Options
#47485 - 04/11/14 06:27 AM User defined data using press talk
William Offline
OL Newbie

Registered: 05/07/12
Posts: 1
Loc: Wellington, New Zealand
Hi,

I used the code below for a CSV file from an earlier post made. It works really well, but was hoping someone could help me define some customizations to it.

define(&s, string, '')
define(&sLine, string, '')
&s := &str + ','
&sLine := ''

search(&s, ',')
&sLine := &sLine + &s + left(' ', 50 - length(&s))
endsearch()

if(&sCurName = '')
&sCurName := mid(&sLine, 1, 10)
else()
if(mid(&sLine, 1, 10) <> &sCurName)
doform()
clearpage()
&sCurName := mid(&sLine, 1, 10)
endif()
endif()

set(¤t.line,¤t.line + 1)
store(¤t.line,&sLine)

if(ge(¤t.line,¤t.lpp))
doform()
clearpage()
endif()

Instead of putting them in a line per record, I wanted them to have a line per field.

For example:

John, john@bla.com, book1
John, john@bla.com, book2
John, john@bla.com, book3

would display as:

John
john@bla.com
book1
John
john@bla.com
book2
John
john@bla.com
book3

And so on..

Hope that makes sense..

Cheers
William

Top
#47486 - 04/11/14 07:22 AM Re: User defined data using press talk [Re: William]
Philippe F. Offline
OL Expert

Registered: 09/06/00
Posts: 1984
Loc: Objectif Lune, Montreal, Qc
The following should work:
Code:
define(&sLine, string, '')
define(&bFirstPass,boolean,true)

search(&str, ',')
  if(&bFirstPass)
    if((&sCurname<>&str) and &sCurName<>'') 
      doform()
      clearpage()
    endif()
    &sCurname := &str
    &bFirstPass := false
  endif
  set(&current.line,&current.line + 1)
  store(&current.line,trim(&str))
endsearch()
set(&current.line,&current.line + 1)
store(&current.line,trim(&str))

if(&current.line>=&current.lpp)
  doform()
  clearpage()
endif()


Note that &sCurrname must be initialized as an empty global variable of type string.
_________________________
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen

Top