Further to Don's basic idea, I tried a formula for rv1 like this:

P1F1 cases
  case convert["GZZZZ9";subfield[cv;" ";4]] of 4 endof
  case convert["GZZZZ9";subfield[cv;" ";3]] of 3 endof
  case convert["GZZZZ9";subfield[cv;" ";2]] of 2 endof
  case convert["GZZZZ9";subfield[cv;" ";1]] of 1 endof
  default 0
endcases

Then rv1 can be used in two ways: 1) it is true when there is a house
number, false otherwise, and 2) it can be used as the subfield number of the
house number, as in this formula for rv2:

convert["GZZZZ9";subfield[P1F1;" ";rv1]]

And, it can also be used to for the street (minus the house number), like
this:

rv1 cases
  case cv=1 of "" endof
  case cv=2 of subfield[P1F1;" ";1] endof
  case cv=3 of subfield[P1F1;" ";1]  " "  subfield[P1F1;" ";2] endof
  case cv=4 of subfield[P1F1;" ";1]  " "  subfield[P1F1;" ";2] " "
subfield[P1F1;" ";3] endof
endcases

Best wishes,
Bruce

2010/12/6 Don Codling <[email protected]>

>  December 6, 2010
>
> Will something like this work?
> Assuming your field is P1F2
> Create a report variable which will hold the number, if any
>
> IF [convert["GZZZZZ";subfield[P1F2;" ";-1]] >0
> THEN convert["GZZZZZ";subfield[P1F2;" ";-1]]
> ELSE 0
> ENDIF
>
> Then you would have to determine the name conditionally as
> P1F2 if rv1 >0
> else cat.t.[subfield[P1F2;" ";-4]; " "; subfield[P1F2;" ";-3]; " ";
> subfield[P1F2;" ";-2]]
> the number of terms would depend on the max number of words in the street
> name. You would have to reformat it to remove opening blanks, or perhaps use
> a cases statement to eliminate terms for nonexistent words.
>
> Don Codling
>
>
> On 06/12/2010 5:31 PM, Tim Rude wrote:
>
> Helmuth,
>
> Is this for a one-time data conversion or is this something that will need
> to happen on a regular basis?
>
> If it's just a one-time conversion, I would export all of the data to a CSV
> file and convert it using some other program such as MS Excel. Then import
> it back into DP.
>
> Otherwise you could probably write a DP report to convert the data, using
> the subfield[] function and virtual subreports to simulate looping through
> the address words. Do-able, but a real pain. DP's string manipulation
> routines have never been particularly impressive.
>
> Tim Rude
>
>
> ----- Original Message -----
> *From:* Helmuth E. Günther <[email protected]>
> *To:* [email protected]
> *Sent:* Monday, December 06, 2010 2:47 PM
> *Subject:* [Dataperf] separate street and house no
>
>  Hi,
>
>
>
> My intention: in a report to separate the content of a field into two parts
> if the last part of the field is a numeric value.
>
>
>
> The field street A50;;N;;T contains the street and the house no.
>
>
>
> Examples:
>
>
>
>             Main Road 5
>
>             Alexander Guido Place 7
>
>             City 2
>
>             Piazza
>
>             City Yard
>
>
>
> As the examples show, not each entry contains a house number. So my
> intention is to find the number of spaces and check if the last part (n-1)
> is a numeric value. If this is true then separate the content of the field
> into two parts e.g. field “street” and field “house no”.
>
>
>
> A appreciate any hint or any help!
>
>
>
> First: how to find the number of spaces?
>
> Second: how to check if the value of the last part of the content is
> numeric?
>
>
>
> Best Regards
>
>
>
> Helmuth E. Günther
>
>
>
>  ------------------------------
> _______________________________________________
> Dataperf mailing list
> [email protected]
> http://lists.dataperfect.nl/mailman/listinfo/dataperf
>
>
> _______________________________________________
> Dataperf mailing 
> [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