Sample for Lan network

Sample for Lan network

Postby Silvio.Falconi » Tue Nov 06, 2018 4:12 pm

Someone have a small sample to manage customers.dbf on Lan Network ?

On sample folder there is not a sample test

I wish a sample test having these features:

- Open customers on Lan Network with some indexes
- Add New record
- Modify the record
- Search a record
- Delete a record
- Print records

everyone must use the same archive customers.dbf and manage it from lan terminals

Until now I tried with Tdatabase class and use system on share mode with no success

I have a specific configuration on my window apps and i cannot change it

I use a easy dialog with fwh explorerbar class at left, a fwh xbrowse , an fwh tab control on the bottom of xbrowse to change order of dbf

I hope for your help!!
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6824
Joined: Thu Oct 18, 2012 7:17 pm

Re: Sample for Lan network

Postby TimStone » Tue Nov 06, 2018 4:54 pm

Silvio,

I'm confused why it is so difficult. I have over 100 different .dbf files in my primary application. I have people with up to 20 workstations on a network all accessing the same files all day long.

In one case, invoices have 8 different .dbf files opened when a workorder is selected. All of their indexes ( .CDX ) are available and a single command can switch them. I use folders, dialogs, browse, gets, and says ... all sharing the same data at the same time.

As stated before, I use tData which extends tDatabase in FWH, and never have a problem.

I think the issue here is that you will have to modify some ( or a lot ) of your code, but once you do it, you will have far more flexibility. Once you do it, then you will never regret it, and everything will be much simpler and clearer.

My code would be quite complex and I just don't have the time to create a simple example. Although my data access is easy, I use a browse and edit fields on the same dialog, all created with resources, and as you change the row in the browse, all of the data for the highlighted record is shown ( updated ) on the data entry screen in the upper half of the dialog. I have a lot of other things happening at the same time to automatically give my users more information to make decisions based on that data, and lots of protections. It's 36 years of constantly upgrading from an old DOS schema to the latest Windows 10 implementation.

I wish you luck. The samples James gave you should allow you to do all you want, but it may mean making changes you just don't want to do.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2905
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Sample for Lan network

Postby Silvio.Falconi » Tue Nov 06, 2018 5:33 pm

Timm,
the tests that James did to me are not good, as I told James I have a specific configuration I can not change.

To me it seems absurd to use for each archive a class and connected to another class (txdata) which in turn is encapsulated in the tdatabase class.

In dos in the old clipper I used the netuse () function successfully and all these problems have never been there because you can not use a similar function even in the window?

Maybe in your country it's easy to do it but I have to be able to configure the xbrowse for example every field I have to change the titles of the columns the size of the picture, I can not limit myself to a main window with tannte child sub windows and many xbrowse in a window and I just do not like it and it's not good for me.

1) I have an annual exercise folder where I insert other folders (dbf, zip, xml, xls, doc, img, ...) and in the dbf folder files and cdx and instead james told me to use only one folder with set default to me is not good

2) at the beginning of the program I have to go to check that the archives and indexes exist in the folder because I have to do it because I do not trust the people who use computers and that fuss between folders, could delete files and cdx, so I prefer to check the opening if the archives exist or are not there. The main problem is that if the program has already been opened by a user and the other user opens it after the procedure stops because it can not create indexes. After many discussions with James (privately) I canceled this check at the beginning of the program but I always have the risk that the archives are not found and if the system is not found crasha

3) I use a specific configuration a main window and a simple dialog with the explorer class menu on the left an xbrowse on the right and a tab under the xbrowse to change the order of the indexes. problems have arisen here because it seems I can not use the aliases to create the xbrowse

4) to do the insertion of a record James has created me a dialog with for example many get but I use the variables ie for example "aGet [1] var cFirst" Jame told me that I have to use "oCustomer: first" directly and then at the bottom "oCustomer: save ()". Here too, problems have arisen because in general this may work but I have to configure and save each field because there could be differences with specific functions it is difficult to explain.

5) up to now with James I have not seen a working test but only
Code: Select all  Expand view
oCustomers := TCustomers():new()
   oCustomers:SetOrder( "city" )
   oCustomers:GoTop()

   oCustomers:skip(10)

   msgInfo(oCustomers:last)        // Shows Farley

   oCustomers:last := "Farley 2"   // change
   oCustomers:save()               // save
   msgInfo(oCustomers:last)        // Shows "Farley 2"

   oCustomers:last := "Farley"
   oCustomers:save()

   select(oCustomers:nArea)
   browse()                         // Shows Farley
 

the sample run ok but what do I solve?

With you dear Timm we talked many times, I agree you have applications that work well for 20 years I believe but maybe they do not have the configurations that I normally use here in Italy, I do not know, it is likely that I'm wrong but I can not go back to my work 20 years before.

Many years ago, exactly in 199/2001, I tried to make programs in the network without success and after 18 years the situation did not change.

in these years I have limited myself to make applications with simple archives in an exclusive way and not to use the network
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6824
Joined: Thu Oct 18, 2012 7:17 pm

Re: Sample for Lan network

Postby Enrico Maria Giordano » Tue Nov 06, 2018 6:29 pm

Silvio.Falconi wrote:Someone have a small sample to manage customers.dbf on Lan Network ?

On sample folder there is not a sample test

I wish a sample test having these features:

- Open customers on Lan Network with some indexes


Code: Select all  Expand view
USE CUSTOMER SHARED

IF NETERR()
    // could not open
ENDIF

SET INDEX TO MYINDEX


Silvio.Falconi wrote:- Add New record


Code: Select all  Expand view
APPEND BLANK
REPLACE …
COMMIT
UNLOCK


Silvio.Falconi wrote:- Modify the record


Code: Select all  Expand view
RLOCK()
REPLACE …
COMMIT
UNLOCK


Silvio.Falconi wrote:- Delete a record


Code: Select all  Expand view
RLOCK()
DELETE
COMMIT
UNLOCK


Use NETERR() to check for successful append and lock.

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

Re: Sample for Lan network

Postby TimStone » Tue Nov 06, 2018 7:20 pm

Silvio:

// Create a Customer object
oCustomer := cCustomer():New()

// Set an index
oCustomer:setorder( 1 ) or oCustomer:setorder( "name" )

// Add a new customer with all locking handled on the network in Shared mode
oCustomer:Append()

// Save a record with all locking handled on the network in Shared mode
oCustomer:Save()

// Move to a new record
oCustomer:Skip()

// Delete a record with all locking in place
oCustomer:Delete()

// Change a customer record field
oCustomer:Name := "Smith, John"

// Change a customer record with a GET
@ 1,10 GET cName VAR oCustomer:Name

// When using an xBrowse with the Customer file
@ 10,10 XBROWSE DATASOURCE oCustomer

Those are examples of how easy it is when you use data objects.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2905
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Sample for Lan network

Postby Silvio.Falconi » Wed Nov 07, 2018 12:25 pm

I tried with Tdatabase , James set the Tcustomers class

I compiled a test.exe

the exe is on a Pc "Docente-0" on c:\work\test and I share the folder with "Everyone"

then
I open on one pc on lan network the exe : it run ok I can show the xbrowse

then I open the exe on another pc on Lan

the oCustomers cannot opened as you can see here

Image

then show this

Image

then I click on button "ok" and it show this

Image




On the First pc where I can show the xbrowse the fields are repeat on xbrowse as you can see here


Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6824
Joined: Thu Oct 18, 2012 7:17 pm

Re: Sample for Lan network

Postby Silvio.Falconi » Wed Nov 07, 2018 12:53 pm

Perhaps I resolved for the visualization

oApp():oGrid := TXBrowse():New( oApp():oDlg )
oCustomers:SetXBrowse( oApp():oGrid )

Instead of

Code: Select all  Expand view

   aBrowse   := { { { || oCustomers:ID }, i18n("ID"), 100, 0,0, },;
                    { { || oCustomers:FIRST }, i18n("First"), 100, 0,0, },;
                    { { || oCustomers:LAST  }, i18n("Last"), 100, 0,0 ,},;
                    { { || oCustomers:STREET}, i18n("Street"), 100, 0,0, },;
                    { { || oCustomers:CITY } , i18n("City"), 50, 0 ,0,} ,;
                    { { || oCustomers:STATE } , i18n("State"), 50, 0,0, } ,;
                    { { || oCustomers:ZIP } , i18n("Zip"), 50, 0 ,0,} ,;
                    { { || oCustomers:HIREDATE } , i18n("Hiredate"), 50, 0,0, } ,;
                    { { || oCustomers:MARRIED } , i18n("Married"), 50, 0,0, } ,;
                    { { || oCustomers:AGE } , i18n("Age"), 50, 0,0, } ,;
                    { { || oCustomers:SALARY } , i18n("Salary"), 50, 0,3,"999,999.99" } ,;
                    { { || oCustomers:NOTES } , i18n("Notes"), 50, 0 ,0,} }

FOR i := 1 TO Len(aBrowse)
      oCol := oApp():oGrid:AddCol()
      //oCol:bStrData := aBrowse[ i, 1 ]
      oCol:bEditValue := aBrowse[ i, 1 ]
      oCol:cHeader  := aBrowse[ i, 2 ]
      oCol:nWidth   := aBrowse[ i, 3 ]
      oCol:nHeadStrAlign := aBrowse[ i, 4 ]
      oCol:nDataStrAlign := aBrowse[ i, 5 ]
       if !Empty(aBrowse[ i, 6 ])
            oCol:cEditPicture:=aBrowse[ i, 6 ]
         Endif
      NEXT

oCustomers:SetXBrowse( oApp():oGrid )

 



But I cannot set the columns
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6824
Joined: Thu Oct 18, 2012 7:17 pm

Re: Sample for Lan network

Postby Silvio.Falconi » Wed Nov 07, 2018 12:58 pm

If I not insert oCustomers:SetXBrowse( oApp():oGrid )

and make only

Code: Select all  Expand view


  oApp():oGrid := TXBrowse():New( oApp():oDlg )

   oApp():oGrid:nTop    := 00
   oApp():oGrid:nLeft   := nSplit+2
   oApp():oGrid:nBottom := oApp():oDlg:nGridBottom
   oApp():oGrid:nRight  := oApp():oDlg:nGridRight

aBrowse   := { { { || oCustomers:ID }, i18n("ID"), 100, 0,0, },;
                    { { || oCustomers:FIRST }, i18n("First"), 100, 0,0, },;
                    { { || oCustomers:LAST  }, i18n("Last"), 100, 0,0 ,},;
                    { { || oCustomers:STREET}, i18n("Street"), 100, 0,0, },;
                    { { || oCustomers:CITY } , i18n("City"), 50, 0 ,0,} ,;
                    { { || oCustomers:STATE } , i18n("State"), 50, 0,0, } ,;
                    { { || oCustomers:ZIP } , i18n("Zip"), 50, 0 ,0,} ,;
                    { { || oCustomers:HIREDATE } , i18n("Hiredate"), 50, 0,0, } ,;
                    { { || oCustomers:MARRIED } , i18n("Married"), 50, 0,0, } ,;
                    { { || oCustomers:AGE } , i18n("Age"), 50, 0,0, } ,;
                    { { || oCustomers:SALARY } , i18n("Salary"), 50, 0,3,"999,999.99" } ,;
                    { { || oCustomers:NOTES } , i18n("Notes"), 50, 0 ,0,} }


FOR i := 1 TO Len(aBrowse)
      oCol := oApp():oGrid:AddCol()
      //oCol:bStrData := aBrowse[ i, 1 ]
      oCol:bEditValue := aBrowse[ i, 1 ]
      oCol:cHeader  := aBrowse[ i, 2 ]
      oCol:nWidth   := aBrowse[ i, 3 ]
      oCol:nHeadStrAlign := aBrowse[ i, 4 ]
      oCol:nDataStrAlign := aBrowse[ i, 5 ]
       if !Empty(aBrowse[ i, 6 ])
            oCol:cEditPicture:=aBrowse[ i, 6 ]
         Endif
      NEXT

   oApp():oGrid:SetRDD()
   oApp():oGrid:CreateFromCode()

 



then the xbrowse not skipping as you can see here

Image

How I must resolve ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6824
Joined: Thu Oct 18, 2012 7:17 pm

Re: Sample for Lan network

Postby Silvio.Falconi » Wed Nov 07, 2018 4:42 pm

Perhaps I found a solution

Code: Select all  Expand view


aBrowse   := { { { || oCustomers:ID }, i18n("ID"), 100, 0,0, },;
                    { { || oCustomers:FIRST }, i18n("First"), 100, 0,0, },;
                    { { || oCustomers:LAST  }, i18n("Last"), 100, 0,0 ,},;
                    { { || oCustomers:STREET}, i18n("Street"), 100, 0,0, },;
                    { { || oCustomers:CITY } , i18n("City"), 50, 0 ,0,} ,;
                    { { || oCustomers:STATE } , i18n("State"), 50, 0,0, } ,;
                    { { || oCustomers:ZIP } , i18n("Zip"), 50, 0 ,0,} ,;
                    { { || oCustomers:HIREDATE } , i18n("Hiredate"), 50, 0,0, } ,;
                    { { || oCustomers:MARRIED } , i18n("Married"), 50, 0,0, } ,;
                    { { || oCustomers:AGE } , i18n("Age"), 50, 0,0, } ,;
                    { { || oCustomers:SALARY } , i18n("Salary"), 50, 0,3,"999,999.99" } ,;
                    { { || oCustomers:NOTES } , i18n("Notesj"), 50, 0 ,0,} }


    oCustomers:SetXBrowse( oApp():oGrid, , , .f. )


   FOR i := 1 TO Len(aBrowse)
      oCol := oApp():oGrid:AddCol()
      //oCol:bStrData := aBrowse[ i, 1 ]
      oCol:bEditValue := aBrowse[ i, 1 ]
      oCol:cHeader  := aBrowse[ i, 2 ]
      oCol:nWidth   := aBrowse[ i, 3 ]
      oCol:nHeadStrAlign := aBrowse[ i, 4 ]
      oCol:nDataStrAlign := aBrowse[ i, 5 ]
       if !Empty(aBrowse[ i, 6 ])
            oCol:cEditPicture:=aBrowse[ i, 6 ]
         Endif
      NEXT


 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6824
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 28 guests