Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GenDBCx - Improved view creation, going in circles
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00884744
Message ID:
00884767
Views:
18
This message has been marked as the solution to the initial question of the thread.
Hi

Okay I seem to have got the thing working as follows. If there are any suggestions pleas do let me know and hope it comes useful to others.
**************************
*** Get Views
**************************
lcCVProc   = ""
lcCrtViews = ""
lcCVStr    = ""

lcProcPrefix = "vw"
IF m.nTotal_Views > 0
	lcCVProc = "CreateViews"
	lcCrtViews = "=this." + m.lcCVProc + "()"
	lcCVStr = GDX_CMDMARGIN + CREATE_VIEWS_LOC
	#IF GDX_SORT_OUTPUT
		=ASORT(aAll_Views,1)
	#ENDIF


*** custom starts
	LOCAL liSaveSelect, li, lcView

	liSaveSelect = SELECT()

	SELECT 0
	CREATE CURSOR cuViews ;
		(cViewName c(150), iOrder i)

	DIMENSION aAll_Views(ALEN(aAll_Views), 1) && so APPEND FROM ARRAY can be used
	APPEND FROM ARRAY aAll_Views


	FOR li = 1 TO ALEN(aAll_Views)
		lcView = ALLTRIM(aAll_Views[li, 1])
		
		SELECT cuViews
		
		LOCATE FOR AT(LOWER(ALLTRIM(lcView)), LOWER(DBGETPROP(ALLTRIM(cuViews.cViewName), "View", "SQL"))) > 0
		
		DO WHILE FOUND()
			REPLACE iOrder WITH iOrder + 1 IN cuViews
			
			CONTINUE
		ENDDO
	ENDFOR
	

	SELECT cViewName ;
		FROM cuViews ;
		ORDER BY iOrder, cViewName ;
		INTO ARRAY aAll_Views

	USE IN cuViews

	DELETE FILE cuViews

	SELECT (liSaveSelect)
*** custom ends


	FOR m.nLoop = 1 TO m.nTotal_Views
		lcProcName = m.lcProcPrefix + ALLTRIM(CHRTRAN(aAll_Views[m.nLoop]," ","_"))
		DO GetView WITH ALLTRIM(aAll_Views[m.nLoop]), m.hOutFile, m.lcProcName
		lcCVStr = lcCVStr + CRLF + GDX_CMDMARGIN + "=this." + m.lcProcName + "()"
		=Stat_Message()
	ENDFOR
ENDIF
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Previous
Reply
Map
View

Click here to load this message in the networking platform