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
Title:
GenDBCx - Improved view creation, going in circles
Miscellaneous
Thread ID:
00884744
Message ID:
00884744
Views:
60
Hi all

I have this code in GenDBCx for the views generation part of it. This was an original idea I received from UT which I had absolutely forgotten about and put on comments in it. The code is to help create before views used in other views. I have been working on it for a couple of days but I am not able to increament the counter iOrder. See the custom code section. I had previsouly tried it as a view cuViews but it didn't work. Please advise what I am doing wrong.
**************************
*** 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
	
*** the custom code starts
iSaveSelect = SELECT()
select 0
Create table cuViews (cView 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])
*!*	?
*!*	?Lower(DBGetProp(Alltrim(lcView), "View", "SQL"))

*!*	wait window Lower(lcView) + str(AT(Lower(lcView), Lower(DBGetProp(Alltrim(lcView), "View", "SQL"))))
*!*	  locate for AT(Lower(lcView), Lower(DBGetProp(Alltrim(lcView), "View", "SQL"))) > 0
*!*	  if found()
*!*		  replace iOrder with iOrder+1
*!*	  endif
  Update cuViews ;
    Set iOrder=iOrder+1 ;
    Where AT(Lower(alltrim(lcView)), Lower(DBGetProp(Alltrim(cuViews.cView), "View", "SQL"))) > 0
Endfor
brow norm

Select cViewName ;
  From cuViews ;
  Order By iOrder ;
  Into Array aAll_Views

USE in cuViews
delete file cuViews
SELECT (iSaveSelect)  
*** the custom code 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
___________________________________________
Next
Reply
Map
View

Click here to load this message in the networking platform