(SOLVED) TO MR.RAO (Error BASE/1004 No export

(SOLVED) TO MR.RAO (Error BASE/1004 No export

Postby dagiayunus » Wed Jul 31, 2024 3:24 pm

Dear Mr.Rao

I am trying to create programe for ledger creation.

I am getting followoing error while click on EDIT buttonbar

Error description: Error BASE/1004 No exported method: EDITBASERECORD
Args:
[ 1] = U
[ 2] = U
[ 3] = L .F.
[ 4] = B {|| ... }
[ 5] = O TXBROWSE
[ 6] = L .T.

Stack Calls
===========
Called from: => EDITBASERECORD( 0 )
Called from: .\LEDGERS.PRG => (b)BRWBTNBAR( 130 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 713 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 999 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1817 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 2051 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3560 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1097 )
Called from: .\MAIN.PRG => MAIN( 44 )


Code: Select all  Expand view  RUN
#include"fivewin.ch"
#include "dbcombo.ch"

//----------------------------------------------------------------------//
FUNCTION Ledger(oWndLedger,oWndMain,oRsLdgr,oCn)
   local oBrw, cClrBack,cCol,aGroups
   local oBar, oMsgBar,oTabs

   if oWndLedger == nil
      DEFINE WINDOW oWndLedger    MDICHILD OF oWndMain TITLE "Ledger"
     
     
     
      //@ 14, 0 TABS oTabs ITEMS "one", "two", "three" OF oWndLedger SIZE oWndLedger:nWidth, 10
     
      @ 2, 0 XBROWSE oBrw OF oWndLedger LINES AUTOSORT ;
         DATASOURCE oRsLdgr ;
         HEADERS "Id","Ledger Name","Cash Op", "Cash Bal","Fine Op","Fine Bal";
         COLUMNS "ledger_id", "ledger_name","ledger_cash_op", "ledger_cash_bal",;
                 "ledger_gold_op","ledger_gold_bal" ;
         NOBORDER FASTEDIT
         
       for each cCol in { "Ledger Name", "Cash Op", "Fine Op" }
         WITH OBJECT oBrw:oCol( cCol )
            :nEditType := EDIT_GET            
         END
      next

      // Load groups for the combo box
      //aGroups := LoadGroups(oCn)
       
      oBrw:l2007:=.f.   
      oBrw:nHeadStrAligns  := AL_CENTER 
      oBrw:nStretchCol   := STRETCHCOL_WIDEST
      OBrw:nRowHeight:=25
     
      oBar  := BrwBtnBar( @oBrw, oWndLedger,@oRsLdgr )

      BrwColors( oBrw )
      BrwRecSel( oBrw, "RECNO" )

      WITH OBJECT oBrw
         :bClrHeader := { || { 255, CLR_YELLOW } } // red text and keeps the background
         // same for footer
        :bClrFooter := { || { 255, CLR_YELLOW} } // red text and keeps the background
       
       
     
       
        :bLDblClick = { || oBrw:EditSource() }
       
        :CreateFromCode()
      END

      WITH OBJECT oWndLedger
         :SetControl( oBrw )
         :bPrint     := { || oBrw:Report( "Groups report",, .F.) }
         :bPostEnd   := { || oWndLedger := nil }
      END

     
      DEFINE MSGBAR oMsgBar OFoWndLedger 2007

      ACTIVATE WINDOW oWndLedger MAXIMIZED
   else
      oWndLedger:SetFocus()
   endif

return nil
//----------------------------------------------------------------------//


static function BrwRecSel( oBrw, cHead )

   WITH OBJECT oBrw
      :lFooter    := .t.
      if "REC" $ Upper( cHead )
         :bRecSelHeader    := { || "RecNo" }
         :bRecSelData      := { |o| o:BookMark }
         :bRecSelClick     := { |o| o:oDbf:OrdSetFocus( 0 ), ;
                                    AEval( o:aCols, { |c| c:cOrder := "" } ), ;
                                    o:Refresh() }
      else
         :bRecSelHeader    := { || "SlNo" }
         :bRecSelData      := { |o| o:KeyNo }
      endif
      :bRecSelFooter    := { |o| o:nLen }
      :nRecSelWidth     := Replicate( '9', Len( cValToChar( Eval( oBrw:bKeyCount, oBrw ) ) ) + 1 )

   END

retur nil

//----------------------------------------------------------------------------//

//----------------------------------------------------------------------------//

static function BrwColors( oBrw )

   local cClrBack

   oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
   oBrw:bClrStd = { || If( oBrw:KeyNo() % 2 == 0, ;
                         { CLR_BLACK, RGB( 198, 255, 198 ) }, ;
                         { CLR_BLACK, RGB( 232, 255, 232 ) } ) }
   oBrw:bClrSel = { || { CLR_WHITE, RGB( 0x33, 0x66, 0xCC ) } }
   cClrBack = Eval( oBrw:bClrSelFocus )[ 2 ]
   oBrw:bClrSelFocus = { || { CLR_WHITE, cClrBack } }
   oBrw:SetColor( CLR_BLACK, RGB( 232, 255, 232 ) )

   oBrw:lHScroll  := .f.

return nil

//----------------------------------------------------------------------------//


//----------------------------------------------------------------------------//

static function BrwBtnBar( oBrw, oWnd, lInvBrowse,oRsLdgr )

   local oBar

   DEFINE BUTTONBAR oBar OF oWnd 2007 SIZE 70, 60 //70

   DEFINE BUTTON OF oBar PROMPT "New" RESOURCE "add" ;
      ACTION oRsLdgr:EditBaseRecord( nil, .t., { |oRec| EditLedgerDlg(oRec) }, oBrw )

   DEFINE BUTTON OF oBar PROMPT "Edit" RESOURCE "edit" ;
      ACTION oRsLdgr:EditBaseRecord( nil, .f., { |oRec| EditLedgerDlg(oRec) }, oBrw, .t. )

   DEFINE BUTTON OF oBar PROMPT "Delete" RESOURCE "del" ;
      ACTION If( MsgYesNo( "Confirm Delete" ), oBrw:Delete(), nil )

   DEFINE BUTTON OF oBar PROMPT "Refresh" RESOURCE "REDO" ;
      ACTION ( oBrw:oDbf:Requery(), oBrw:Refresh(), XEval( oBrw:bChange ), oBrw:SetFocus() ) ;
      TOOLTIP "Read Data Again from the Server"

   
   DEFINE BUTTON OF oBar PROMPT "Preview" RESOURCE "report" ;
      ACTION oBar:oWnd:Print() GROUP

   DEFINE BUTTON OF oBar PROMPT "Close" RESOURCE "exit" ;
      ACTION oBar:oWnd:End()

return oBar

//----------------------------------------------------------------------------//

//----------------------------------------------------------------------------//

// Function to edit or add a new ledger record
static function EditLedgerDlg(oRec)

   local lNew := ( oRec:RecNo == 0 )
   local oDlg, oFont
   local aGroups := LoadGroups(oCn)

   msginfo(orec:recno)
   return
   
   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-15
   DEFINE DIALOG oDlg SIZE 400,470 PIXEL TRUEPIXEL FONT oFont ;
      TITLE If( lNew, "ADD NEW ", "EDIT" ) + " RECORD"

   @ 030,020 SAY "Ledger ID:"       SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 060,020 SAY "Group ID:"        SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 090,020 SAY "Ledger Name:"     SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 120,020 SAY "Cash Opening:"    SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 150,020 SAY "Cash Balance:"    SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 180,020 SAY "Gold Opening:"    SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 210,020 SAY "Gold Balance:"    SIZE 80,20 PIXEL OF oDlg RIGHT

   @ 030,120 GET oRec:ledger_id         SIZE 100,22 PIXEL OF oDlg READONLY RIGHT

/*
   @ 060,120 DBCOMBO oRec:groups_id SIZE 240,300 PIXEL OF oDlg ;
      ALIAS aGroups ITEMFIELD "1" LISTFIELD "2"
*/

     
   @ 090,120 GET oRec:ledger_name       SIZE 240,22 PIXEL OF oDlg VALID !Empty( oRec:ledger_name )
   @ 120,120 GET oRec:ledger_cash_op    SIZE 240,22 PIXEL OF oDlg PICTURE "999,999.99" RIGHT
   @ 150,120 GET oRec:ledger_cash_bal   SIZE 240,22 PIXEL OF oDlg PICTURE "999,999.99" READONLY RIGHT
   @ 180,120 GET oRec:ledger_gold_op    SIZE 240,22 PIXEL OF oDlg PICTURE "999,999.99" RIGHT
   @ 210,120 GET oRec:ledger_gold_bal   SIZE 240,22 PIXEL OF oDlg PICTURE "999,999.99" READONLY RIGHT

   @ 270,020 BTNBMP PROMPT "Save"   SIZE 150,30 PIXEL FLAT OF oDlg ;
      ACTION ( If( oRec:Modified(), oRec:Save(), nil ), oDlg:End() ) WHEN oRec:Modified()
   @ 270,240 BTNBMP PROMPT "Cancel" SIZE 150,30 PIXEL FLAT OF oDlg ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED

   oFont:End()

return nil



// Function to load group IDs and names for the DBCombo
function LoadGroups(oCn)
   local oRs, aGroups

   oRs :=oCn:rowset("SELECT groups_id, groups_name FROM groups")

   aGroups := {}
   oRs:MoveFirst()
   do while !oRs:EOF
      AAdd(aGroups, { oRs:Fields("groups_id"):Value, oRs:Fields("groups_name"):Value })
      oRs:MoveNext()
   enddo

   oRs:Close()
   return aGroups


//----------------------------------------------------------------------------
Last edited by dagiayunus on Wed Aug 07, 2024 5:39 pm, edited 1 time in total.
Regards
Yunus

FWH 21.02
dagiayunus
 
Posts: 85
Joined: Wed Nov 19, 2014 1:04 pm

Re: TO MR.RAO ( Error description: Error BASE/1004 No export

Postby nageswaragunupudi » Wed Jul 31, 2024 4:06 pm

This is how your should understand the error.log
Please see
Code: Select all  Expand view  RUN
Error description: Error BASE/1004 No exported method: EDITBASERECORD
Args:
[ 1] = U


This means oRs is NIL. And obviously NIL has not exported method.
It is for you to figure out why the oRs is NIL at the time of execution
Regards

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

SOLVED. TO MR.RAO (Error BASE/1004)

Postby dagiayunus » Sat Aug 03, 2024 1:19 pm

Dear Mr.Rao

Thanks for your guide. there was error to pass parameter to function. so oRs was NIL

Regards

This is how your should understand the error.log
This means oRs is NIL. And obviously NIL has not exported method.
It is for you to figure out why the oRs is NIL at the time of execution
Regards

G. N. Rao.
Hyderabad, India
Regards
Yunus

FWH 21.02
dagiayunus
 
Posts: 85
Joined: Wed Nov 19, 2014 1:04 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 50 guests