Hi Brian;

Thanks for your lengthy explanation. Just one question. I would need 
a formula for extracting the last word in the panel itself not in a 
report. Can this be done in a simple way without cases? 

Malkie

> Hi Malkie,
> 
> mmm...  Not sure exactly what you mean. With the looping structure
> example you just use 3 RVs, you start with the data you want to parse
> and place it into say RV1, RV2 sets the upper range of the looping, it
> can be any number, just needs to exceed the maximum case you are ever
> expecting (a bit like thinking that 640K is enough for DOS - old joke)
> and then collecting your result in RV3. When you exit the looping the
> result you need is in RV3.
> 
> So wherever in a report you were going to say use a formula approach
> you would just place that looping structure instead, so there is no
> need to be "import into each record", which was the part in your reply
> I did not understand.
> 
> However on reflection perhaps you are commenting about the other uses
> that I use these looping structures. Because in the previous example
> the number of loop is arbitrary if could be 40 like I used as a limit
> in last words example, or it could be 100,000 it makes the structure
> versatile for processing large chunks of data. 
> 
> So for instance let say you have a web page with many items being
> selected, lets for argument say a Shipping Cart for an eStore. These
> might be submitted to the server in say a batch, from the client web
> application, or might be trickled into the application record by
> record there might be Item1=Apple Item1Qty=5, Item2=Orange Item2Qty=12
> etc... You really want the person to visit you shop and keep shopping,
> so you do not want to set an arbitrary limit say that you can only
> handle 10 items, you want them to keep filling that darn shopping cart
> till it overflows... you will be happy if they have Item365=Cake
> Item365Qty=1 or more. So using a formula which limits the number of
> items it can handle would be quite a problem and very limiting to your
> income. So if I were doing this in a web application I would need at
> least a panel which had 3 fields ShoppingCartID, Fieldname, Field
> data. This means if they had 365 items selected in their shopping
> cart, my scripts would import in 2 times 365 (730) records via a DP
> Synthetic Transaction Log, and I could use some looping structure to
> find specific items. So I could use a looping structure to group all
> my say Item234 records ( a loop and a skip too). Of course I could
> have used far more than 2 field of information for each shopping cart
> item. I might have had price, colour, size, brand, ItemID, etc,
> meaning far more records imported, but now I could group all these
> items together by using a the generic looping structure that I used
> for the Last word example but I have the flexibility of using the a
> simpler formulae and set an arbitrary upper limit on my shopping cart
> to 1000 items or 10,000 items. It doesn't really matter, I do not have
> to loop over every one of them as long as I have an exit condition in
> the loop, I can also process the set from either the bottom of the set
> or from the top, just by decrementing or incrementing the loop
> counter, and changing the exit condition, but the core logic of the
> data extraction formula would essentially remain the same.
> 
> I hope that explains it better
> 
> Regards
> Brian
> 
> 
> 
> 
> 
> 
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> [email protected]
> Sent: Wednesday, 12 August 2009 8:33 PM
> To: [email protected]
> Cc: Don Friedman
> Subject: Re: [Dataperf] Extracting Words URGENT
> 
> Thank you Don Friedman, Don Codling, Mark, Geert and Brian for 
> your responses and suggestions. Although the Cases is exactly what I
> did yesterday when I didn't hear from any of you and I needed it very
> urgently, I was still hoping that there would be a simpler solution
> for the future. 
> 
> Don, you say there's no easy way to do this. The reason I assumed
> there would be a simpler solution was because I think of DataPerfect
> as a family or branch of WordPerfect. In WP there's an option to sort
> by the last word or second to last word. e.g. When sorting Secondary
> Merge Files, the index can be: Field 1, Line 1, Word -1 which sorts it
> by the last word or for Sort by Line: Field 1, Word -1.
> 
> Brian, your idea of nesting a subreport by creating such a loop is
> good but  how does it automatically get imported into each record?
> Would I have to export the report and import it to the panels? 
> 
> Malkie
> 
> > August 11, 2009
> > 
> > Malkie, I don't think there is an easy way to do this, because DP
> > does not allow counting subfields backwards. So you need a formula
> > like this, in which the highest number equals the maximum number of
> > words in the target field. Of course each extra line requires an
> > extra "ENDIF".
> > 
> > If subfield[P2F3;" ";8 > "" then  subfield[P2F3;" ";8]
> > elseif  subfield[P2F3;" ";7] > "" then  subfield[P2F3;" ";7]
> > elseif  subfield[P2F3;" ";6] > "" then  subfield[P2F3;" ";6]
> > elseif  subfield[P2F3;" ";5] > "" then  subfield[P2F3;" ";5]
> > elseif  subfield[P2F3;" ";4] > "" then  subfield[P2F3;" ";4]
> > elseif  subfield[P2F3;" ";3] > "" then  subfield[P2F3;" ";3]
> > elseif  subfield[P2F3;" ";2] > "" then  subfield[P2F3;" ";2]
> > else P2F3
> > ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF
> > 
> > REMEMBER, you have to use the F4 selection to put in meaningful
> > field names. Aside from that you can copy & paste this, as expanded
> > for your need, from your word processor.
> > 
> > To get everything but the first word shoud be fairly easy. I have
> > not tested this, though. cat.t[subfield[P2F3;" ";2]; subfield[P2F3;"
> > ";3]; subfield[P2F3;" ";4]; subfield[P2F3;" ";5]; subfield[P2F3;"
> > ";6]; subfield[P2F3;" ";7]; ...  subfield[P2F3;" ";17]]
> > 
> > To get everything but the last word is harder. I have not tested
> > this, either. But try something like cat.t[if subfield[P2F3;" ";2] =
> > "" then "" else subfield[P2F3;" ";1] endif; if subfield[P2F3;" ";3]
> > = "" then "" else subfield[P2F3;" ";2] endif; if subfield[P2F3;"
> > ";4] = "" then "" else subfield[P2F3;" ";3] endif;   ... {To the
> > highest number of words in your field}]
> > 
> > Don Codling
> > Windows XP home, SP3
> > 2 GBytes RAM
> > 
> > [email protected] wrote:
> > > Hi Everyone;
> > >
> > > I desperately need your expertise. I would like to make a formula
> > > in a field (not in a report) that would automatically extract the
> > > last word of another field, something like with a subfield or
> > > substring function or whatever. The amount of words in that field
> > > are not identical. It can vary between 2 and 10 or even more.  
> > >
> > > Also, how would I extract all the words of a field besides the
> > > last word or besides the first word?
> > >
> > > Malkie
> > >
> > > _______________________________________________
> > > Dataperf mailing list
> > > [email protected]
> > > http://lists.dataperfect.nl/mailman/listinfo/dataperf
> > >
> > >   
> > _______________________________________________
> > Dataperf mailing list
> > [email protected]
> > http://lists.dataperfect.nl/mailman/listinfo/dataperf
> 
> 
> _______________________________________________
> Dataperf mailing list
> [email protected]
> http://lists.dataperfect.nl/mailman/listinfo/dataperf
> 
> _______________________________________________
> Dataperf mailing list
> [email protected]
> http://lists.dataperfect.nl/mailman/listinfo/dataperf


_______________________________________________
Dataperf mailing list
[email protected]
http://lists.dataperfect.nl/mailman/listinfo/dataperf

Reply via email to