FWTool to automate DBF and mod harbour

FWTool to automate DBF and mod harbour

Postby Otto » Mon Oct 25, 2021 5:57 am

Hello friends,
I am working on a tool to automate source code generating for DBF data handling in mod harbour.

Best regards,
Otto

Get data from DBF file:
DBF data first is stored to a Hash.

Then Hash is passed to a JSON object.

JSON object is passed to the HTML FORM


Save data to DBF file
HTML FORM fields passed to the JSON object.
JSONobject posted with AJAX to mod harbour prg

Here we store the data to the DBF file.


DBF file
HASH

JSON object

FORM fields

object <- form fields


AJAX
object

HASH

SAVE DBF
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6312
Joined: Fri Oct 07, 2005 7:07 pm

Re: FWTool to automate DBF and mod harbour

Postby Otto » Mon Oct 25, 2021 8:21 am

DBF to HASH
Image

FORM to ISON object
Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6312
Joined: Fri Oct 07, 2005 7:07 pm

Re: FWTool to automate DBF and mod harbour

Postby Otto » Mon Oct 25, 2021 2:44 pm

Changing the link to the DBF file in my FWToolX and you get all the source code for a FORM.

Image

Image

Image

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6312
Joined: Fri Oct 07, 2005 7:07 pm

Re: FWTool to automate DBF and mod harbour

Postby James Bott » Mon Oct 25, 2021 8:37 pm

Otto,

I am not sure exactly what you are doing. It appears that you are just using the standard TDatabase class?

In other words, are you doing:

oCustomers:= TDatabase():New(...)

Or:

oCustomers:= TCustomers():new()

You should be using the second example so you can build lots of code into the customers class. Note that I use the plural name (customers) for the customer table and the singular name (customer) for a single customer record.

Also, here is some food for thought. Ideally, you should create a database class for DBFs and another database class for SQL databases. And they should use the identical syntax (mostly). If you do that, then you can just swap the database class to switch from using DBFs to SQL without changing all the rest of your code.

So for instance this syntax:

msgInfo( oCustomers:phone )

Would work with either database class. This is one of the great features of object oriented programming.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: FWTool to automate DBF and mod harbour

Postby Otto » Tue Oct 26, 2021 5:23 am

Dear James,

I'm making a tool here to generate source code for mod harbour.
The tool helps you the way that you do not have to enter your database fieldnames manually.

What exactly is happening? I am creating the source code automatically for:

1) Creating a HASH and filling with DBF data.

sample:
Code: Select all  Expand view
hTmp[ "ADDRESS1" ] :=   STRTRAN( field->ADDRESS1, CRLF, "<br>" )  
  hTmp[ "ADDRESS2" ] :=   STRTRAN( field->ADDRESS2, CRLF, "<br>" )


2) The HASH is passed to HTML in the program with TEMPLATE params.

Code: Select all  Expand view
TEMPLATE PARAMS hTmp
<script>
   var object=<?prg return hb_jsonEncode( hTmp, .T. )?>;
 </script>





3) Then the HTML code for an HTML form.

Code: Select all  Expand view
<FORM>
 <label for="address1">address1</label><br>
       <input type="text" id="address1" name="address1" value=" "><br>
       <label for="address2">address2</label><br>
       <input type="text" id="address2" name="address2" value=" "><br>
</FORM>
 


4) Then JavaScript source that it needs to fill the HTML form.


JS
Code: Select all  Expand view
document.getElementById( "address1" ).value = object[  "ADDRESS1" ];
document.getElementById( "address2" ).value = object[  "ADDRESS2" ];





5) And finally, JavaScript code which converts the values of the form back into a JSON object.

JS
Code: Select all  Expand view
object[ "ADDRESS1" ] = document.getElementById("address1").value;      
object[ "ADDRESS2" ] = document.getElementById("address2").value;




The JSON object is then sent back to the SERVER using AJAX, where the values are read out and saved back into the DBF file.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6312
Joined: Fri Oct 07, 2005 7:07 pm

Re: FWTool to automate DBF and mod harbour

Postby Otto » Tue Oct 26, 2021 7:55 am

Dear James,
For a better understanding, I have created a flow chart to show which parts of the source code I automatically generate with the FWToolX.
Best regards,
Otto

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6312
Joined: Fri Oct 07, 2005 7:07 pm

Re: FWTool to automate DBF and mod harbour

Postby Silvio.Falconi » Tue Oct 26, 2021 8:22 am

Otto wrote:Dear James,
For a better understanding, I have created a flow chart to show which parts of the source code I automatically generate with the FWToolX.
Best regards,
Otto

Image



why do you insist on putting posts in this section of the forum when there is already a particular section for mod_harbour?
Whenever I write and ask for help immediately enter a message related to modharbour / html and your pseudo report generator even if it is not specifically required but you insist on putting these types of messages, I have already told you that before using one thing I want to be sure that that thing has a future, that is, since 1992 many projects have been opened, never finished,
do I have to list all the projects that * someone * started without finishing them?

first of all fwppc I can no longer use this tool because it is no longer compatible with smathphones with windows that are there now, project started and never finished because he could find a way to make it work even on new windows smartphones or find a trick to use it in Android.

Here we have wasted time doing all this bullshit while we had to invent something to make the fivewin language work also on ANDROIDs but it was not done by anyone and we lost many possibilities

and now we waste time making report generators that are not visual, that is we cannot draw, and there would already be ER of which you are the main lovers but all in all there are few people who use ER, since some do not understand others have folded on FR or CR or other application to generate reports ... / i zi pi zi / what's the use? if it's not visual but why don't we join forces to create something powerful instead do all this bullshit that leads us nowhere

Am I not right?
and then let's look at the "Easyreport" forum when the last message dates back to ask for ER support .. in 2020 and it is my compilation request from githu, what does this mean?

my alogic leads me to think that they are all ER experts or that nobody uses it

I do not want to make unnecessary controversies because you have the support of antonio linares but I kindly ask you to use the appropriate section for modharbour

thanks



p.s. however the flowchart is wrong - :D :D :D :D :D :D
p.s.2 "Vamos a la conquista de la Web" so you won't conquer the web, but not if you cry in turkish
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: FWTool to automate DBF and mod harbour

Postby Otto » Tue Oct 26, 2021 8:45 am

Silvio,

I put this here as this has nothing to do with mod harbour.

It is a tool I write in FIVEWIN.
Would you mind publishing your corrections of the flow chart?



Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6312
Joined: Fri Oct 07, 2005 7:07 pm

Re: FWTool to automate DBF and mod harbour

Postby Silvio.Falconi » Tue Oct 26, 2021 9:20 am

Otto wrote:Silvio,

I put this here as this has nothing to do with mod harbour.

It is a tool I write in FIVEWIN.
Would you mind publishing your corrections of the flow chart?



Best regards,
Otto

>Would you mind publishing your corrections of the flow chart?
no I would never dare, you are a computer teacher right?
In computer science, the flow chart is a graphical representation of the operations to be performed for the execution of an algorithm. Each single step is displayed by a series of standard symbols.
for example you used a symbol for internal memory which is not really about internal memory :D
but I will not correct it, you are the expert !!!
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: FWTool to automate DBF and mod harbour

Postby Otto » Tue Oct 26, 2021 3:57 pm

Silvio,
but aren't the Harbour hash and the JS object in internal memory, one on server and one on the client's memory?
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6312
Joined: Fri Oct 07, 2005 7:07 pm

Re: FWTool to automate DBF and mod harbour

Postby Otto » Tue Oct 26, 2021 8:26 pm

Hello friends,
I just succeeded in reading a DBF record with the source code that I create with FWToolX, changing it in a web form and then save it.

Best regards,
Otto


Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6312
Joined: Fri Oct 07, 2005 7:07 pm

Re: FWTool to automate DBF and mod harbour

Postby csincuir » Tue Oct 26, 2021 9:26 pm

Interesting Otto, nice work.
Best regards

Carlos
csincuir
 
Posts: 407
Joined: Sat Feb 03, 2007 6:36 am
Location: Guatemala

Re: FWTool to automate DBF and mod harbour

Postby Otto » Wed Oct 27, 2021 6:54 pm

Hello friends,.
Starting with a web program, creating a web form is a time-consuming job.
I can now automatically create the source code and simply design the FORM with drag & drop.
Years ago I made a Fivewin program to sort and recreate the database structures, which is now helpful.

Best regards,
Otto

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6312
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 47 guests