Information générale
Catégorie:
Codage, syntaxe et commandes
Titre:
Problems using array created from SELECT
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
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement