Open 3 SQL tables

Post Reply
User avatar
ctoas
Posts: 103
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

Open 3 SQL tables

Post by ctoas »

Hello friends.

In a module, I have a mysql table loaded and I need to open two more to save data, but when I try to do an xBrowse with data from the second or third it presents an error.

Code: Select all

    oRsLOTEAMENTO := oServer:ROWSET("SELECT * FROM loteamentos ORDER BY nome")
    oRsSOCIOS     := oServer:ROWSET("SELECT * FROM socio ORDER BY loteamento")
    oRsLOTES      := oServer:ROWSET("SELECT * FROM lotes ORDER BY loteamento")
 

Code: Select all

       @ 0069,0000 XBROWSE oBrwLOTEAMENTOS OF oDlgLOTEAMENTOS SIZE 0520,0230 STYLE FLAT PIXEL NOBORDER DATASOURCE oRsLOTEAMENTO//AUTOSORT   
            
        ADD TO oBrwLOTEAMENTOS DATA oRsLOTEAMENTO:nome   PICTURE "@!" HEADER "Nome"   WIDTH 520
        ADD TO oBrwLOTEAMENTOS DATA oRsLOTEAMENTO:bairro PICTURE "@!" HEADER "Bairro" WIDTH 260               
        ADD TO oBrwLOTEAMENTOS DATA oRsLOTEAMENTO:cidade PICTURE "@!" HEADER "Cidade" WIDTH 260               

        oBrwLOTEAMENTOS:nColDividerStyle := 0          
        oBrwLOTEAMENTOS:nRowDividerStyle := 0           
        oBrwLOTEAMENTOS:nMarqueeStyle    := 5
        oBrwLOTEAMENTOS:lHScroll         := .F.
        oBrwLOTEAMENTOS:lVScroll         := .T.
        oBrwLOTEAMENTOS:lRecordSelector  := .F.
        oBrwLOTEAMENTOS:bKeyChar         := {|nKey|IIF(nKey==VK_RETURN,((OPERACAO_LOTEAMENTOS(2))),)}
        oBrwLOTEAMENTOS:bClrSelFocus        := {||{nRGB(000,000,000),nRGB(150,150,150)}}
        oBrwLOTEAMENTOS:bClrSel            := {||{nRGB(000,000,000),nRGB(150,150,150)}}
        oBrwLOTEAMENTOS:bClrStd             := {||{CLR_BLUE,IIF(oRsLOTEAMENTO:KeyNo() %2==0,CLR_WHITE,nRGB(232,232,232))}}
        oBrwLOTEAMENTOS:nHeaderHeight    := 40 
        oBrwLOTEAMENTOS:bClrHeader       := {||{nRGB(000,000,000),nRGB(150,150,150)}}
        oBrwLOTEAMENTOS:bSeek            := {|c|.F.}
            
        oBrwLOTEAMENTOS:aCols[1]:oHeaderFont := ARIAL16B
        oBrwLOTEAMENTOS:aCols[1]:bLClickHeader := {|r,c,f,o| nil}
        oBrwLOTEAMENTOS:aCols[2]:oHeaderFont := ARIAL16B  
        oBrwLOTEAMENTOS:aCols[2]:bLClickHeader := {|r,c,f,o| nil}
        oBrwLOTEAMENTOS:aCols[3]:oHeaderFont := ARIAL16B  
        oBrwLOTEAMENTOS:aCols[3]:bLClickHeader := {|r,c,f,o| nil}
                
        oBrwLOTEAMENTOS:CreateFromCode()
 

Code: Select all

       @ 0069,0000 XBROWSE oBrwSOCIOS OF oFldLOTEMENTOS:aDialogs[2] SIZE 0120,0230 STYLE FLAT PIXEL NOBORDER DATASOURCE oRsSOCIOS
            
       ADD TO oBrwLOTEAMENTOS DATA oRsSOCIOS:nome        PICTURE "@!"  HEADER "Nome" WIDTH 0520     <------ ERROR !!!!
       ADD TO oBrwLOTEAMENTOS DATA oRsSOCIOS:porcentagem PICTURE "999" HEADER "%"    WIDTH 0018                  

        oBrwSOCIOS:nColDividerStyle := 0          
        oBrwSOCIOS:nRowDividerStyle := 0           
        oBrwSOCIOS:nMarqueeStyle    := 5
        oBrwSOCIOS:lHScroll         := .F.
        oBrwSOCIOS:lVScroll         := .T.
        oBrwSOCIOS:lRecordSelector  := .F.
        oBrwSOCIOS:bKeyChar         := {|nKey|IIF(nKey==VK_RETURN,((OPERACAO_LOTEAMENTOS(2))),)}
        oBrwSOCIOS:bClrSelFocus      := {||{nRGB(000,000,000),nRGB(150,150,150)}}
        oBrwSOCIOS:bClrSel           := {||{nRGB(000,000,000),nRGB(150,150,150)}}
        oBrwSOCIOS:bClrStd           := {||{CLR_BLUE,IIF(oRsSOCIOS:KeyNo() %2==0,CLR_WHITE,nRGB(232,232,232))}}
        oBrwSOCIOS:nHeaderHeight    := 40 
        oBrwSOCIOS:bClrHeader       := {||{nRGB(000,000,000),nRGB(150,150,150)}}
        oBrwSOCIOS:bSeek            := {|c|.F.}
            
        oBrwSOCIOS:aCols[1]:oHeaderFont := ARIAL16B
        oBrwSOCIOS:aCols[1]:bLClickHeader := {|r,c,f,o| nil}
        oBrwSOCIOS:aCols[2]:oHeaderFont := ARIAL16B  
        oBrwSOCIOS:aCols[2]:bLClickHeader := {|r,c,f,o| nil}
                
        oBrwSOCIOS:CreateFromCode()
 
Error description: Error BASE/1004 Class: 'NIL' has no exported method: NOME
ADD TO oBrwLOTEAMENTOS DATA oRsSOCIOS:nome        PICTURE "@!"  HEADER "Nome" WIDTH 0520

Can someone help?

Thanks
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Open 3 SQL tables

Post by nageswaragunupudi »

Error description: Error BASE/1004 Class: 'NIL' has no exported method: NOME
That means this sql statement failed to open rowset.

Code: Select all

oRsSOCIOS     := oServer:ROWSET("SELECT * FROM socio ORDER BY loteamento")
 
Whenever you try to open a rowset, check if the rowset is opened successfully or not.

Code: Select all

oRs := oCn:RowSet( ... )
if oRs == nil
   // failed to open
   // take appropriate action
endif
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Open 3 SQL tables

Post by nageswaragunupudi »

Important advice for creating xbrowse:

Code: Select all

       @ 0069,0000 XBROWSE oBrwLOTEAMENTOS OF oDlgLOTEAMENTOS SIZE 0520,0230 STYLE FLAT PIXEL NOBORDER DATASOURCE oRsLOTEAMENTO//AUTOSORT   
            
        ADD TO oBrwLOTEAMENTOS DATA oRsLOTEAMENTO:nome   PICTURE "@!" HEADER "Nome"   WIDTH 520
        ADD TO oBrwLOTEAMENTOS DATA oRsLOTEAMENTO:bairro PICTURE "@!" HEADER "Bairro" WIDTH 260              
        ADD TO oBrwLOTEAMENTOS DATA oRsLOTEAMENTO:cidade PICTURE "@!" HEADER "Cidade" WIDTH 260              
 
Please do not create xbrowse and add columns with "ADD TO oBrw" command
Long long time back we created these commands to make it easy for users to migrate from wbrowse and tcbrowse to xbrowse.
These commands do not let you avail the full power of xbrowse.

Please create like this:

Code: Select all

@ 0069,0000 XBROWSE oBrwLOTEAMENTOS OF oDlgLOTEAMENTOS SIZE 0520,0230 STYLE FLAT PIXEL NOBORDER DATASOURCE oRsLOTEAMENTO ;
   COLUMNS "Nome", "Barirro", "Cidade" ;
   ; // HEADERS ... only if headers are different from column names
   PICTURES "@!","@!", "@!"
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
ctoas
Posts: 103
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

Re: Open 3 SQL tables

Post by ctoas »

Thanks Nages (How should we call you Nages or Rao?)

I found my stupidity ... kkkk

Just let me ask you one more question about xBrowse.
Would you like to remove any visual effect from the header when clicked and also the arrow indicating the sorting, is it possible?
Use

Code: Select all

oBrw:aCols[1]:bLClickHeader := {|r,c,f,o| nil}
this removes the change of order, but not the visual effects

Thanks
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Open 3 SQL tables

Post by nageswaragunupudi »

Enrico Maria Giordano wrote:
ctoas wrote:(How should we call you Nages or Rao?)
+1 :-)

EMG
Rao
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Open 3 SQL tables

Post by nageswaragunupudi »

this removes the change of order, but not the visual effects
Please let me know the FWH version you are using.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Open 3 SQL tables

Post by Enrico Maria Giordano »

nageswaragunupudi wrote:
Enrico Maria Giordano wrote:
ctoas wrote:(How should we call you Nages or Rao?)
+1 :-)

EMG
Rao
Ok, Mr. Rao!

EMG
User avatar
ctoas
Posts: 103
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

Re: Open 3 SQL tables

Post by ctoas »

Hello Mr. Rao

I'm using version 18.01
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Open 3 SQL tables

Post by nageswaragunupudi »

We have not provided any simple way to prevent the painting of the sort bitmaps.

I suggest this work-around:

Code: Select all

oBrw:cSortOrders := ""
 
Regards

G. N. Rao.
Hyderabad, India
Post Reply