Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AValidators.prg Errors and Wizard problems
Message
General information
Forum:
Visual FoxPro
Category:
COMCodebook
Title:
AValidators.prg Errors and Wizard problems
Miscellaneous
Thread ID:
00729861
Message ID:
00729861
Views:
64
When the wizard sets up a new COMCodeBook environment it generate a aValidators.prg with the following section:
*------------------------------------------------------
Define CLASS UserValidator AS IValidator OLEPUBLIC
*------------------------------------------------------
     Name = "UserValidator" 
     
  Function vldUsrname(tcValue, tlPreStatus, roMessage)
    Local llRetVal
    llRetVal=.T.

    *-- NOTE: You will need to fill in this method
    *--       if you want validation on field USRNAME of table USER
    *
    * It must be a Present
    IF llRetVal AND (ISNULL(tcValue) OR EMPTY(tcValue))
      llRetVal = .F.
      IF VARTYPE(roMessage) = "O"
        roMessage.AddMessage("UserEmptyUsrName", THIS.NAME )
      ENDIF
    ENDIF
    * It must be character
    IF llRetVal AND (VARTYPE(tcValue) # 'C')
      llRetVal = .F.
      IF VARTYPE(roMessage) = "O"
        roMessage.AddMessage("UserNonCharacterUsrName", THIS.NAME )
      ENDIF
    ENDIF
    * It must be no more than 18 characters
        THIS.DebugLog( "Value:"+ ALLTRIM(tcValue) +":")
    IF llRetVal AND (LEN(ALLTRIM(tcValue)) > 18)
      llRetVal = .F.
      IF VARTYPE(roMessage) = "O"
        roMessage.AddMessage("UserTooLongUsrName", THIS.NAME )
      ENDIF
    ENDIF
    Return llRetVal
  EndFunc
  
Enddefine 
This does not work as validation fails over and over during testing.

But the sample Attoney Application has the following in its aValidators.prg
*------------------------------------------
DEFINE CLASS aValidator AS iValidator
*------------------------------------------
    cMessagingType = "XML"
ENDDEFINE

*------------------------------------------------------
DEFINE CLASS AttorneyValidator AS aValidator OLEPUBLIC
*------------------------------------------------------
	Name = "AttorneyValidator"
	*------------------------------------------
	FUNCTION vldLastName( tcValue, tlPreStatus, roMessage)
	*------------------------------------------
		LOCAL llRetVal

		llRetVal = .NOT. EMPTY( tcValue )
		If NOT llRetVal 
			if vartype(roMessage) = "O"
				roMessage.AddMessage("AttorneyEmptyLastName", THIS.Name )
			Endif	
		Endif

		RETURN llRetVal
	ENDFUNC
	
ENDDEFINE
The sample Attorney application works in its validation and If I modify the Wizard generated code to look like the Attorney App aValidators.prg then it will work also. So now I will get on my soap box.

Rant On
If this Code has been tested and placed in the public domain, why am I finding so many problems/errors/bugs with it? I know you all can say 'You get what you pay for' but if COMCodeBook is placed on the UT and supposedly supported on the UT (which I can hardly tell as no one responsible for COMCodeBook has responded to my recent posts) and anyone can download the App/Wizards from the UT, then should there have been some simple testing for the app. I can understand if the app was labled Beta, but it was not and it is failing from the start. Examples of the above and GetPrimaryKey not firing are two things that should have been found right away from anyone testing the application generated by the Wizards that were supplied. I want to be able to evaluate COMCodeBook as a solution to our 3-tier venture, but I find that I am doing more Code testing and debuging than evaluating.
Rant off
Bret Hobbs

"We'd have been called juvenile delinquents only our neighborhood couldn't afford a sociologist." Bob Hope
Reply
Map
View

Click here to load this message in the networking platform