Grande Quintas.
Mês passado estava usando Hash e fiz assim:
Código: Selecionar todos
Private hIrMemo := Hash(; //Memória de C lculo IRRF
'BaseVerbasIncidentesVinculoPrincipal', 0.00,;
'BaseVerbasIncidentesVinculoOutros', 0.00,;
'BaseVerbasDeducoes' , 0.00,;
'ValorDescPrevidencia' , 0.00,;
'ValorDescPrevidenciaOutros', 0.00,;
'DependenteIRQuantidade' , 0,;
'DependenteIRValorBase' , 0.00,;
'DeducaoInativo65Anos' , 0.00,;
'BaseCalculoIrrfNormal' , 0.00,;
'ValorDeduzirIRSimplificado' , 0.00,;
'BaseCalculoIrrfSimplificado', 0.00,;
'ValorAliquotaIRRF' , 0.00,;
'ValorDeducaoIRRF' , 0.00,;
'ValorIRRFPago' , 0.00,;
'ValorIRRFLancado' , 0.00;
)
HSet( hIrMemo, 'BaseVerbasIncidentesVinculoPrincipal' , MVANT )
HSet( hIrMemo, 'BaseVerbasIncidentesVinculoOutros' , mVant2 )
HSet( hIrMemo, 'ValorVerbasDeducoes' , MDESC + mDesc3 )
HSet( hIrMemo, 'ValorDescPrevidencia' , nValorInss )
HSet( hIrMemo, 'ValorDescPrevidenciaOutros' , mInss2 )
HSet( hIrMemo, 'DependenteIRQuantidade' , nQtdDepIR )
HSet( hIrMemo, 'DependenteIRValorBase' , M->irDedDepen )
HSet( hIrMemo, 'DeducaoInativo65Anos' , mDeduz65 )
HSet( hIrMemo, 'BaseCalculoIrrfNormal' , mRetorno )
HSet( hIrMemo, 'ValorDeduzirIRSimplificado' , M->irDedSimpl )
HSet( hIrMemo, 'BaseCalculoIrrfSimplificado' , mRetorno2 )
HSet() is the functional equivalent of the hash access operator [ ] in conjunction with the inline assignment operator :=. It provides the same functionality for populating a hash or changing the value of existing key/value pais, but is slightly less efficient.
Outro exemplo (do manual):
Código: Selecionar todos
// The example demonstrates two posibilities of populating a hash
// and changing its values.
PROCEDURE Main
LOCAL hHash := {=>}
hHash[ "A" ] := 10
HSet( hHash, "B", 20 )
? ValToPrg( hHash )
// result: { "A" => 10, "B" => 20 }
hHash[ "B" ] := 100
HSet( hHash, "A", 200 )
? ValToPrg( hHash )
// result: { "A" => 200, "B" => 100 }
RETURN
Abraços.