Page 4 of 4

Re: HMG Tutorial Was born

Posted: Wed Sep 03, 2014 7:03 pm
by zolysoftsolutions
A huge work..
Thank you very much Giovani!

Re: HMG Tutorial Was born

Posted: Mon Dec 07, 2015 9:48 pm
by mol
esgici wrote:
mol wrote:.. known an way to test if index of associative array is defined?...

Code: Select all

? HB_HPOS( hMyHash, 'NotFoundIndex')  // --> 0
You can found details here.
I tried to use associative array to translate logical vaue:

Code: Select all

 aYesNo := {=>}
 aYesNo[ .f. ] := "No"
 aYesNo[ .t. ] := "Yes"
 
I got an compiler error.
Logical keys are not allowed? Am I right? Has abybody more experiences with this?

Re: HMG Tutorial Was born

Posted: Mon Dec 07, 2015 10:47 pm
by Carlos Britos
I got an compiler error.
Logical keys are not allowed? I'm right? Has abybody more experiences with this?
Hi Mol,
I think you need to search in harbour sources/samples for hb_hash()

Code: Select all

to define  hash:

myHash := { "item1"=> .T. ,;
                   "item2" => 1234 ,;
                   "item3" => date() }

setting another value

myHash[ "item1" ] := .F.                   


Re: HMG Tutorial Was born

Posted: Tue Dec 08, 2015 12:09 am
by esgici
mol wrote: I tried to use associative array to translate logical vaue:

Code: Select all

 aYesNo := {=>}
 aYesNo[ .f. ] := "No"
 aYesNo[ .t. ] := "Yes"
 
I got an compiler error.
Logical keys are not allowed? I'm right? Has abybody more experiences with this?
Thanks Marek, you are right :arrow:

Has been made correction in VivaClipper page :
Typing :

<key> part of a hash may be any legal scalar type : C, D, L, N ...

Correction : This definition is wrong ! The correct is :

<key> entry key; can be of type: number, date, datetime, string, pointer.


Corrected at : 2015.12.08; thanks to Marek.
Viva HMG :D