Hola Charly
Thanks to nice words
If not disturbed anyone, I can speech more and more long
cdsaenz wrote:
- .. (SQL language) Very nice believe me.
For me, no ! I don't like someone ( in fact something

) worked in place of me
cdsaenz wrote:
But we'll do without it.
Certainly ! So, we must do !
cdsaenz wrote:
- I've built a function to get my stuff to a temp table. I need the reverse now.
For reverse process, we have consider some situations :
- First, we have assure every (or necessary) field content validated for proper value
- How we'll implement records deleted by user in temple-table ( exists or not in original detail file )
- Records newly added by user may require extra key-field informations, such as sub-number etc
- Does user will have right of changing key field content ? If so, does we need extra cautions ?
cdsaenz wrote:
- About BROWSE.. After some reading here I decided to move all to GRID...
Good choice
cdsaenz wrote:
( BROWSE vs GRID) Not sure now. I would just stick to one of them.. But if you say it's better for this..
No, it isn't better nor can be. May be only preferable under some situations and we haven't any of its for now.
cdsaenz wrote:
One thing I noticed, I couldn't assign an alias in runtime to rowsource.. is that right? I mean I tried to do form1.grid.rowsource := cTempTableAlias and got a compiling error.. (?)
Yes we could. Without your code and error message I can't say anything.
cdsaenz wrote:
Below the code, bear with me, I'm going back to Clipper (I got carried away by aliased functions!)
Your code is very good; certainly a Clipper'ist mind and coding
Code: Select all
/* temp file name */
cFileTo := "tmpdetail" /*DTOS(DATE()) + STRTRAN(TIME(),":","")*/
Though commented and no need with HB_DBCreateTemp; you don't need construct a name to your temp-table such as
DTOS(DATE()) + STRTRAN(TIME(). Anyway, this formula doesn't assure uniqueness of file name ( within a second may be built more than one file) Instead, Harbour have two nice function for this purpose :
Code: Select all
TempFile( <cDir>, <cExt>, <nAttr> ) => <cTempFileName>
and
Code: Select all
HB_FTempCreateEx( @<cFileName>, [cDir], [cPrefix], [cExtention], [nAttr] ) => <fhnd>
Please keep in mind that first function return a character value as file name and second return a numeric value as file handle. For getting file name from second function, we'll use <cFileName>; as syntax implied it must be passed by reference.
Note : I know its exist and I had already use; but for now I can't use TempFile(). Anyway this is an unnecessary detail for now, because HB_DBCreateTemp() doesn't require an UNIQUE file name. In fact the syntax of this function is :
Code: Select all
HB_dbCreateTemp( <cAlias>, <aStruct>, <cRDD>, <cCodePage>, <nConnection> ) -> <lSuccess>
while the first parameter is alias, not file name.
Code: Select all
/* copy stru from original detail and open temp*/
SELECT (cFileFrom)
COPY STRUCTURE TO (cFileTo)
USE (cFileTo) NEW EXCLUSIVE
With this way you couldn't use HB_dbCreateTemp. May be like this :
Code: Select all
SELECT (cFileFrom)
aTempFileStru := DBSTRUCT()
cTempFileAlias := "TempDetail"
if !HB_dbCreateTemp( cTempFileAlias, aTempFileStru ) // Unsuccessful
MsgBox( "Cannot create temporary table: " + cTempFileAlias )
...
endif
Code: Select all
/* should be setordered */
SELECT (cFileFrom)
SEEK xMasterValue
DO WHILE (&(INDEXKEY(0)) = xMasterValue)
Perhaps you are thinking somethings like this, when your code will put to run:
(After assigned a value to <nOrder>)
Code: Select all
SELECT (cFileFrom)
DBSETORDER( nOrder ) // or SET ORDER TO nOrder
SEEK xMasterValue
DO WHILE (&(INDEXKEY(nOrder)) = xMasterValue)
( Order 0 (zero) meant natural order. )
Though this is a statement correct in syntax, calling a function inside of conditional statement doesn't seem to me as a good way. Instead may think :
Code: Select all
cDetailIndxKey := INDEXKEY(nOrder)
DO WHILE (cDetailIndxKey) = xMasterValue)
( Caution : not tried :( )
Code: Select all
FOR i:=1 TO (cFileTo)->(FCOUNT())
(cFileTo)->(FIELDPUT(i, (cFileFrom)->(FIELDGET(i))))
NEXT
Very nice
I'm still waiting your "working" sample
Saludos
--
Esgici