Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with Alias does not exist
Message
From
25/04/2022 15:52:43
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01684254
Message ID:
01684262
Views:
30
SWAG Alias()# "V_Work"

untested
IF !EMPTY( this.control_source )
       local lcAlias, lcField, lSource
       lcSource = ALLTRIM(this.control_source)
	lcAlias = Left( m.lcSource), AT('.', m.lcSource) - 1)
       lcField = Subst( m.lcSource), AT('.', m.lcSource) + 1)
	IF SELECT( m.lcAlias ) > 0
		IF EVALUATE( m.lcSource) == OLDVAL( m.lcField, m.lcAlias )		
			RETURN .T.
		ENDIF 
      ENDIF
ENDIF
V_WORK.EMPLOYEE
>>
>>The code then checks is the value of the field EMPLOYEE in the cursor V_WORK has been change. Here is the code:
>>
>>
>>		cControlSource = ALLTRIM( this.control_source )
>>		IF EVALUATE( cControlSource ) == OLDVAL( cControlSource )		
>>			RETURN .T.
>>		ENDIF 
>>
>>
>>The problem occurs on the line above, EVALUATE( cControlSource ) == OLDVAL( cControlSource ), and it does
>>ALIAS IS NOT FOUND. I verified that the entry in .control_source exists as described above.
>>
>>TIA.
>>
>>UPDATE. the following code checks that the alias V_WORK exist and is open. This code, below, is before the code above (just in case someone wonders if the alias is indeed exists and open
>>
>>
>>IF !EMPTY( this.control_source )
>>	cAlias = SUBSTR( ALLTRIM(this.control_source), 1, AT('.',ALLTRIM(this.control_source)) - 1)
>>	IF SELECT( cAlias ) > 0
>>		cControlSource = ALLTRIM( this.control_source )
>>		IF EVALUATE( cControlSource ) == OLDVAL( cControlSource )		
>>			RETURN .T.
>>		ENDIF 
>>      ENDIF
>>ENDIF
>>
>
>I added - for testing - a TRY / CATCH around the above code. Then modified the line:
>
>cControlSource = ALLTRIM( this.control_source )
>
>to a bogus:
>
>cControlSource = "test.test_field" 
>
>
>And the error caught by the TRY / CATCH, says "Alias 'test' not found".
>But the error that the customer saw (without a TRY /CATCH) did not have the "bad" alias name. It was simply:
>ALIAS IS NOT FOUND
>
>Any suggestions?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform