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