Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problems using array created from SELECT
Message
De
15/06/2004 01:52:07
Al Doman (En ligne)
M3 Enterprises Inc.
North Vancouver, Colombie Britannique, Canada
 
 
À
15/06/2004 01:42:53
Randy Wessels
Screentek Business Solutions, Llc.
Phoenix, Arizona, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00913760
Message ID:
00913762
Vues:
16
>I am trying to create an array from a select and then use the values in the array in an insert statement. I read somewhere that if you create an array with a select and there is no data, the array isn;t created. Becuase of this, I added a check to _tally and created the arrays manually. Before I made the change I was getting voidarray does not exist. After my change I am getting operator/operand type mismatch. Any ideas?
>
>SELECT tpi
> SCAN
> IF tpi.creditmemo = .T.
> SELECT totaldue FROM vi INTO ARRAY voidtotal WHERE invno = tpi.ordnum
> IF _TALLY = 0
> DIMENSION voidtotal[1]
> voidtotal[1] = SPACE(1)
> ENDIF
> SELECT totalpaid FROM vi INTO ARRAY vitotalpaid WHERE invno = tpi.ordnum
> IF _TALLY = 0
> DIMENSION vitotalpaid[1]
> vitotalpaid[1] = SPACE(1)
> ENDIF
> INSERT INTO payinv (invno,custno,company,invdate,changed,totaldue,totalpaid,creditInv);
> VALUES (tpi.ordnum,tpi.custno,tpi.company,tpi.invdate,tpi.changed,tpi.totaldue+voidtotal-;
> vitotalpaid,;
> 0.00,tpi.invno)
> SELECT invpost
> UPDATE invpost SET totaldue = tpi.totaldue+voidtotal-vitotalpaid ;
> WHERE invno = tpi.ordnum
> UPDATE invpost SET totaldue = tpi.totaldue+voidtotal-vitotalpaid ;
> WHERE invno = tpi.invno
> TABLEUPDATE()
> SELECT tpi
> ELSE
> INSERT INTO payinv (invno,custno,company,invdate,changed,totaldue,totalpaid) ;
> VALUES (tpi.invno,tpi.custno,tpi.company,tpi.invdate,tpi.changed,tpi.totaldue,;
> tpi.totalpaid)
> ENDIF
>ENDSCAN

1. In your INSERT and UPDATE should you not be referencing voidtotal[1] and vitotalpaid[1]?
2. You've set the values of the arrays to SPACE(1) if not present. Should you not be using zero?
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform