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
#23260 - 02/08/10 11:44 AM Data capture problem
gdwojo Offline
Junior Member

Registered: 01/14/10
Posts: 1
Loc: Virginia
I am working in version 7..

I need to create a summary of an e-mail message - and I want to reorganize the data into a table format -

The data comes in in the format below, and I would like it to create a table the contains the Part number, Quantity, Description, and price.

LINE NUMBER: 11180241
QUANTITY: 2
UNIT OF MEASURE: EA
DESCRIPTION: XER106R01221 ** XeroxHigh-Cap Toner Cartridge,f/ Phaser
6360,18000 Pg Yld,Black
PART NUMBER: XER106R01221
UNIT PRICE: 216.14
INTERNAL REFERENCE: N421580036031E
VENDOR REBATE CODE:
NSN:
AUX PART NUMBER: 106R01221

LINE NUMBER: 11180242
QUANTITY: 1
UNIT OF MEASURE: EA
DESCRIPTION: LEX15M0120 ** INKCART,HI-RES,Z51,COL
PART NUMBER: LEX15M0120
UNIT PRICE: 39.36
INTERNAL REFERENCE: N421580036039E
VENDOR REBATE CODE:
NSN:
AUX PART NUMBER: 15M0120

I would like the output to be (in a column like format to be something like:

XER106R01221 2 EA 238.14
LEX15M0120 1 EA 43.36

etc..

Can anyone tell me if this can be done, and give recommendations on a solution? Because the data may wrap, the text will not always show up in the same location, so I think I will have to find the title (e.g. Unit Price) and then capture the data that follows it, I can foresee an if then loop process - but can't find anything in Design that would facilitate that

Thanks,

Gary

Top
#23261 - 02/09/10 10:44 AM Re: Data capture problem
Anonymous
Unregistered


Gary,

You'll probably have to look into creating a user-defined emulation that will "stabilize" your data so that it's always on the same lines regardless. Change the emulation to "User Defined", click on the "Use PressTalk Editor" button and replace what is there by the following:

Code:
if( ( pos('LINE NUMBER:' , &str ) = 1 ) and (&current.line > 3  ) )
  doform()
  clearpage()
endif()

if(pos('PART NUMBER:', &str) =  1)
  &current.line := 8
elseif()
  &current.line := &current.line + 1
endif()

store(&current.line,&str)
if(ge(&current.line,&current.lpp))
  doform()
  clearpage()
endif()
As for the counters, this could be done using VBScript and an intermediate file, requiring two processes. In terms of doing it within PlanetPress Design directly this, as far as I know, would be very hard.

My suggestion would be to go towards PlanetPress 7 and use the new Metadata tools, these would help sort and manage your document much more easily. Besides, Version 5 is no longer officially supported (I'm not precisely sure even why this forum is still open actually), so updating would be very important at this point.

Hope this helps,
Eric.

Top
#23262 - 02/09/10 11:26 AM Re: Data capture problem
Anonymous
Unregistered


Hi gdwojo,

It seems like all informations are always in the same order. Your idea of finding specific strings of text is the right one.

You could create a global variable for each info you want to put in the table. Then, in a presstalk object, loop through each line of data to find the info you want to assign, using the "pos" presstalk command. For example, look for the string "QUANTITY" to start writing into your variable, and stop writing when you find the string "UNIT OF MEASURE".

Here is an example to get you started (I will not define local and global variables here and I assume there will be only 1 set of data per data page).
Code:
First, you want to find all relevant strings that will allow you to know where to start and finish reading to fill your variables. Here, we will find the line number and column number where each info starts.

For(&iLineCounter,1,1,&current.lpp)
  if(pos('QUANTITY',@(&iLineCounter,1,999))>0)
    &iQtyPos:=pos('QUANTITY',@(&iLineCounter,1,999))
    &iQtyLine:=&iLineCounter
  endif
  if(pos('UNIT OF MEASURE',@(&iLineCounter,1,999))>0)
    &iUnitOfMeasurePos:=...
    &iUnitOfMeasureLine:=...
  endif
  etc...
  etc...
endfor
-------

Then, once you know on which line to find your infos and at which column they start, you can assign the data to the variables that will fill your table. You will want to determine for how many lines you will be writing data into the same variable by substracting the line number of the variable you are filling to the line number of the next info type:

&iLinesToUseForWriting:=&iUnitOfMeasureLine-&iQtyLine
-------

Then you will do a "For Loop" with the resulting line amount to populate your variable

For(&iLineCounter,&iQtyLine,1,&iLinesToUse)
  if(&iLineCounter=&iQtyLine)
    &sQty:=&sQty+trim(@(&iLineCounter,&iQtyPos,999))
  elseif()
    &sQty:=&sQty+trim(@(&iLineCounter,1,999))
  endif()
endfor
------

Repeat the last 2 steps for every single variable you want to populate (Lines to use+For loop to populate)
----- 
Please note that this code was not tested in PlanetPress and could contain minor syntax errors. This is only to show you the big picture of how this can be achieved using presstalk.
Also note that this code sample is "hardcoded" and will generate a lot of loops and presstalk. You could use functions and arrays to minimize the amount of code needed and prevent the same code to be repeated everytime for each "info type" you want to put in the table.

For more assistance please contact either our Support Department or our training department. You can also contact your sales rep if you would like us to do it for you via our professional services dept.

Thanks. Regards,

Olivier

Top


Moderator:  OL Newsgroup Support