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:57
 
 
À
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:
00913763
Vues:
20
Randy
    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
Firstly, you are setting voidtotal and vitotalpaid to SPACE(1) if there are no results from the SELECT but then you are using these strings as numerics in the subsequent calculations.

Secondly, even if there are results which are stored in an array you are not referencing the array elements using arrayName[] syntax in the subsequent calculation but rather just the array name.

When you get the error what line does it occur on?


>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
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform