malkie i have looked over the formula, and hopefully the following corrects it. the expression length[substring[P1F7]] should be length[subfield[P1F7; " " ; 1]]. as for the question re arguments, substring requires 3 'arguments' - the field; the first character and the length of the string. in addition, i had omitted asterisks in the contains statement; withou them, it would only be true if # is the entire record
i am on my vista computer know so was not able to test it as i still have not found a way to run dos on it if contains[P1F7;"*#*"] then substring[P1F7; length[subfield[P1F7; " " ; 1]] + 2 ; length[subfield[P1F7;"#";1]] - length[subfield[P1F7; " " ; 1]] -2] else substring[P1F7; length[subfield[P1F7; " " ; 1]] + 2; length[P1F7] - length[subfield[P1F7; " " ; 1]] -2] endif hope this works now robert On Sun, Jan 18, 2009 at 12:13 PM, <[email protected]> wrote: > Thank you Robert for your response. I've copied your entire formula > into that field and replaced your P1F7 by selecting the actual field > with F4. For some reason I keep getting the message: "incorrect > number of arguments for function" pointing after the first > "length[substring[P1F7]]". I cannot figure out what this means. Are > you sure this is the correct formula? > > And regarding your question, there's always a space before the "#" > and there might or might not be any commas beforehand. I've no idea > what my client entered into that field. If it's important I can check. I > don't think this should make a difference, though. > > > since sending the formula, i realize that i didn't think about - not > > did you mention, whether your existing data has a comma and space > > preceding thin coming > > > > On Sun, Jan 18, 2009 at 11:50 AM, Robert Pollard > > <[email protected]>wrote: > > > > > malkie > > > > > > here is one way that might work, although there may be simpler ones > > > > > > if contains[P1F7;"#"] then substring[P1F7; > > > length[substring[P1F7]]+2; length[subfield[P1F7;"#";1]] - > > > length[substring[P1F7]] -2] else substring[P1F7; > > > length[substring[P1F7]]+2; length[P1F7] - length[substring[P1F7]] > > > -2] endif > > > > > > hth > > > > > > robert > > > > > > > > > On Sun, Jan 18, 2009 at 7:21 AM, <[email protected]> wrote: > > > > > >> I would like to divide an address field of 50 characters into 3 (a) > > >> house number; (b) apartment number; (c) everything in between > > >> > > >> (a) field has the formula: subfield[P1F7;' ';1] > > >> (b) field has the formula: If contains[P1F7;"*#*"] then > > >> "#"subfield[P1F7;"#";2] else " " endif > > >> What's the formula for (c) field? > > >> > > >> 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
