Converting an old Clipper app

Post Reply
User avatar
Silvio.Falconi
Posts: 7119
Joined: Thu Oct 18, 2012 7:17 pm

Converting an old Clipper app

Post by Silvio.Falconi »

I must ocnverte these lines from old clipper
someone can help me please (I use cdx tag)

or->(dbCreateIndex("orario.$$1", ;
"MA->prec + DO->punti", {|| ;
(MA->(dbGoto(OR->materia)), ;
DO->(dbGoto(OR->prof)), MA->prec + ;
DO->punti + eval({|| (DevPos(14, 14), iif(!EOF(), ;
DevOut(Replicate("²", RecNo() * 51 / LastRec())), Nil), ;
"")}))}))

OR->(dbCreateIndex("orario.$$2", ;
"OR->classe + str( OR->gruppo, 3 ) + OR->gg_ora", ;
{|| OR->classe + Str(OR->gruppo, 3) + OR->gg_ora + ;
eval({|| (DevPos(14, 14), iif(!EOF(), DevOut(Replicate("²", ;
RecNo() * 51 / LastRec())), Nil), "")})}))
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
James Bott
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Converting an old Clipper app

Post by James Bott »

Wow, that is some really complex stuff. It gives me a headache just to look at it.

What is the problem? Have you tried compiling it and it generates errors? If so, what are the errors?

Something else?
User avatar
Silvio.Falconi
Posts: 7119
Joined: Thu Oct 18, 2012 7:17 pm

Re: Converting an old Clipper app

Post by Silvio.Falconi »

James,
I wrote on private email to you for this problem
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
mercurial
Posts: 16
Joined: Wed Feb 04, 2015 2:26 pm

Re: Converting an old Clipper app

Post by mercurial »

These calls create indexes and use a "trick" to show a progress bar, that is calculated and shown for each record, together with cursor positioning. I don't know which Clipper version you were using with that code but [x]Harbour can call a callback function every x indexed records. In this way you'll use a supported, official, less invasive tecnique.
Please open the file std.ch from [x]Harbour include directory and search for INDEX ON and you will find that INDEX ON.... is split into ordCondSet() and ordCreate() function calls. With the first call you can specify filters and also the callback function. It seems to me that the progress bar is 50 chars wide... with the new functions you will move the cursor, calculate and display the progress bar only 50 times...

You say that you use the cdx tag. But it seems to me that you are not actually using multitag (one file with multiple indexes inside) but only one file one index in cdx format. But I may be wrong.

orario.$$2 seems "easy".

What puzzle me a bit is orario.$$1...

Code: Select all | Expand


or->(
   dbCreateIndex("orario.$$1",           // for each record in OR(ario)
      "MA->prec + DO->punti",
      {|| (MA->(dbGoto(OR->materia)), ;  // move record in workarea MA(terie)
           DO->(dbGoto(OR->prof)),       // move record in workarea DO(centi)
           MA->prec + DO->punti + ;      // create the string to use as index
           eval( {||""}) ;               // eval always returns ""
           )  }  )  )
 


Probably I'd use a SET RELATION and not the dbGoto... well, actually the dbGoto is the equivalent of the SET RELATION... but SET RELATION moves the pointers in other workareas automatically... but you need to set them up every time you open the files... so PROs and CONS...

Anyway, I think that this is a smart way to avoid using a new table for setting the relations between the three records...!
Post Reply