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 16:50:24
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01240829
Message ID:
01240872
Views:
25
No, it needs to handle it after each message, not just the last one. Right now it is doing it after each message, except the last one. I guess I could just make the call again outside the loop, but it seems like it could be handled in one call with the correct conditional.

>If you want to handle this AFTER the last message put the IF .. outside the FOR ... ENDFOR loop:
>
>strProcessData = tInput
>
>m.MessageCount     = 0
>m.MessageLineCount = 0
>m.StoreMessage     = .F.
>FOR ix=1 TO ALINES(laLines,strProcessData)
>   ....
>*** Do something with m.StoreMessage, it must be .T. when
>*** you want to store mesage
>ENDFOR
>
>IF m.StoreMessage AND m.MessageCount > 0
>   ? 'STORE MESSAGE'
>ENDIF
>
>
>
>>>
>>>IF m.StoreMessage AND m.MessageCount > 0
>>>   m.StoreMessage = .F.
>>>   ? 'STORE MESSAGE'
>>>ENDIF
>>>
>>
>>Almost, but this does exactly what I want except the STORE after the last message:
>>
>>
>>strProcessData = tInput
>>
>>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'
>>				IF m.MessageCount > 0
>>					? 'STORE MESSAGE'
>>				ENDIF
>>				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
>>
>>ENDFOR
>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform