Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting the horse in front of the cart
Message
From
16/07/2007 15:11:33
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Getting the horse in front of the cart
Miscellaneous
Thread ID:
01240829
Message ID:
01240829
Views:
80
I'm trying to determine how to "do something" whenever the message is completed and
before the next message starts. I've always had trouble figuring out how to get X to
be Y, but only after the first time, or something to that effect. In the code below,
it is only running the STORE after MSH displays, but only from the second occurrence
on. I'm trying to get it to STORE after each message has been displayed. Thanks!
strProcessData = tInput

m.StoreMessage = .F.
m.MessageCount = 0
m.MessageLineCount = 0

FOR ix=1 TO ALINES(laLines,strProcessData)

		STORE LineToObject(laLines[m.ix]) TO ('loObj'+LTRIM(STR(m.ix)))
		m.Segment = ALLTRIM(UPPER(EVALUATE('loObj'+LTRIM(STR(m.ix))+".Segment")))
		DO CASE 
			CASE m.Segment = 'MSH'
				m.StoreMessage = .T.
				m.MessageCount = m.MessageCount + 1
				m.MessageLineCount = 1
				? LTRIM(STR(m.MessageCount)) + ' - ' + LTRIM(STR(m.MessageLineCount )) + ': ' + 'MSH Segment'
			CASE m.Segment = 'EVN'
				m.MessageLineCount = m.MessageLineCount + 1
				? LTRIM(STR(m.MessageCount)) + ' - ' + LTRIM(STR(m.MessageLineCount )) + ': ' + 'EVN Segment'
			CASE m.Segment = 'PID'
				m.MessageLineCount = m.MessageLineCount + 1
				? LTRIM(STR(m.MessageCount)) + ' - ' + LTRIM(STR(m.MessageLineCount )) + ': ' + 'PID Segment'
			CASE m.Segment = 'PV1'
				m.MessageLineCount = m.MessageLineCount + 1
				? LTRIM(STR(m.MessageCount)) + ' - ' + LTRIM(STR(m.MessageLineCount )) + ': ' + 'PV1 Segment'
			CASE m.Segment = 'FT1'
				m.MessageLineCount = m.MessageLineCount + 1
				? LTRIM(STR(m.MessageCount)) + ' - ' + LTRIM(STR(m.MessageLineCount )) + ': ' + 'FT1 Segment'
			CASE m.Segment = 'ORC'
				m.MessageLineCount = m.MessageLineCount + 1
				? LTRIM(STR(m.MessageCount)) + ' - ' + LTRIM(STR(m.MessageLineCount )) + ': ' + 'ORC Segment'
			CASE m.Segment = 'DG1'
				m.MessageLineCount = m.MessageLineCount + 1
				? LTRIM(STR(m.MessageCount)) + ' - ' + LTRIM(STR(m.MessageLineCount )) + ': ' + 'DG1 Segment'
			OTHERWISE
				m.MessageLineCount = m.MessageLineCount + 1
				? LTRIM(STR(m.MessageCount)) + ' - ' + LTRIM(STR(m.MessageLineCount )) + ': ' + 'Undefined Segment'
		ENDCASE

	IF m.StoreMessage AND m.MessageCount > 1
		m.StoreMessage = .F.
		? 'STORE MESSAGE'
	ENDIF

ENDFOR
Next
Reply
Map
View

Click here to load this message in the networking platform