what should happen if

GCC Consulting gcc at optonline.net
Fri Nov 19 09:16:11 PST 2004


 


________________________________

	From: filepro-list-bounces at lists.celestial.com
[mailto:filepro-list-bounces at lists.celestial.com] On Behalf Of Robert Pulliam
M.D.
	Sent: Friday, November 19, 2004 11:22 AM
	To: filepro-list at seaslug.org
	Subject: what should happen if
	
	
	    Filepro 5.0
	   Record is as follows-
	 
	CLM*INV1191*175***11::1*Y*A*Y*A*B~
	There is only one field in this record as above     
	    
	INV1191 is the invoice # and can contain up to 8  numbers after the INV.
	 
	I use a mid string function as follows:
	 
	aa = mid(1,"8","8")
	aa then equals 1191*175
	 
	I then set ab(8,.0) = aa
	I expected this to give and edit error but ab was actually 1191.   This
works fine for my purposes but I was surprised that it worked.
	When I test the .0 edit I cannot enter 1191*175 as expected, it only
takes 1191.  The fact that this works prevents looping or using the instr
function to extract the actual invoice number.  Is this expected behavoir?  Is
there a better way to extract the number from this field - the number following
the INV may be between one and eight numbers.   This works for any of these.
	 
	Thanks in advance -  Robert P. Pulliam M.D. 

Since you know the starting point, you could loop through the field using a
counter
  if:
 then: ct="8"   'start looking
loop if:
   Then:aa(1,.0)=mid(1,ct,"1")
     if: aa ne "*" 	'test for end of invoice element
   Then: ct=ct+"1";ab(8,.0)=ab{aa;GOTO loop      'ab= is one way or you could do
the line below
     if: 
   then:ab=mid(1,"8",(ct-"1"))

This routine will build the invoice # for you in field ab.

With a little more programming you could use this loop to extract all of the
values from this string.

Set a counter for each element of the string that you want to extract and use 2
variables with the mid statement adjusting them to meet your needs.  The last ct
will be the beginning point of the next element.

In the case above you have 12 elements although come of the are blank **.

Others on the list may have other solutions.  EDI is always a pain.

Richard Kreiss
GCC Consulting 	




More information about the Filepro-list mailing list