Open 3 SQL tables

Open 3 SQL tables

Postby ctoas » Tue Feb 16, 2021 7:48 pm

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  Expand view

    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  Expand view

       @ 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  Expand view

       @ 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
ctoas
 
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil

Re: Open 3 SQL tables

Postby nageswaragunupudi » Tue Feb 16, 2021 10:04 pm

Error description: Error BASE/1004 Class: 'NIL' has no exported method: NOME

That means this sql statement failed to open rowset.
Code: Select all  Expand view

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  Expand view

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

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

Re: Open 3 SQL tables

Postby nageswaragunupudi » Tue Feb 16, 2021 10:10 pm

Important advice for creating xbrowse:
Code: Select all  Expand view

       @ 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  Expand view

@ 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
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Open 3 SQL tables

Postby ctoas » Tue Feb 16, 2021 11:47 pm

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  Expand view
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
ctoas
 
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil

Re: Open 3 SQL tables

Postby Enrico Maria Giordano » Wed Feb 17, 2021 8:27 am

ctoas wrote:(How should we call you Nages or Rao?)


+1 :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8709
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Open 3 SQL tables

Postby nageswaragunupudi » Thu Feb 18, 2021 6:21 am

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: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Open 3 SQL tables

Postby nageswaragunupudi » Thu Feb 18, 2021 6:22 am

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
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Open 3 SQL tables

Postby Enrico Maria Giordano » Thu Feb 18, 2021 8:51 am

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
Enrico Maria Giordano
 
Posts: 8709
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Open 3 SQL tables

Postby ctoas » Thu Feb 18, 2021 4:16 pm

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
ctoas
 
Posts: 115
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil

Re: Open 3 SQL tables

Postby nageswaragunupudi » Sun Feb 21, 2021 8:31 pm

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

I suggest this work-around:

Code: Select all  Expand view

oBrw:cSortOrders := ""
 
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 20 guests