Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Jamie Osborn
  Where is Jamie Osborn?
 Melbourne
 Australia
 Jamie Osborn
 To: Anil Tayal
  Where is Anil Tayal?
 Delhi
 India
 Anil Tayal
 Tags
Subject: RE: Updateable Cursor problem
Thread ID: 15876 Message ID: 15886 # Views: 1 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Thursday, October 03, 2002 1:19:04 AM         
   


> Hi Friends,
>
> After hearing too much about the updateable cursors I am using one for the first time.I have a question :
>
> Can a specify this type of a filter condition ?
>
> invmaster.type=iif(gnAmount>0,2,1)
>
> When I do type this condition, VFP automatically puts this in quotation marks and when I try to browse the cursor it says "Operator/Operand Type Mismatch".
>
> BTW, this is the complete SQL statement generated :
>
>
>
 SELECT Stocktrn.date, Invmaster.inv_name, Stocktrn.inv_no,;
>   Stocktrn.total_amount, Stocktrn.paid_amt,;
>   Stocktrn.total_amount-Stocktrn.paid_amt AS balance, Stocktrn.paid,;
>   0.00 AS curr_amt, Stocktrn.trid;
>  FROM  stock!invmaster INNER JOIN stock!stocktrn ;
>    ON  Invmaster.id = Stocktrn.type;
>  WHERE Stocktrn.paid <> .T.;
>    AND Stocktrn.party = ?fintrn.party;
>    AND Invmaster.type = "iif(?gnAmount>0,2,1)" 

>
>
> What should I do to get this functionality ?
>
> Thanx,
>
> Anil


I've never need to create a view with an IIF() condition in it but I can't see why it wouldn't work.
If the view designer is giving you hassle then create the view in code :
CREATE SQL VIEW AS MyView ;
SELECT Stocktrn.date, Invmaster.inv_name, Stocktrn.inv_no,;
   Stocktrn.total_amount, Stocktrn.paid_amt,;
   Stocktrn.total_amount-Stocktrn.paid_amt AS balance, Stocktrn.paid,;
   0.00 AS curr_amt, Stocktrn.trid;
  FROM  stock!invmaster INNER JOIN stock!stocktrn ;
    ON  Invmaster.id = Stocktrn.type;
  WHERE Stocktrn.paid <> .T.;
    AND Stocktrn.party = ?fintrn.party;
    AND Invmaster.type = iif(?gnAmount>0,2,1) 

Then you'll need to set the update field eg.

DBSETPROP('MyView','View','SendUpdates',.T.) && Make the view update
DBSETPROP('MyView.id','Field','Keyfield',.T.) && Which field(s) are the keyfields ...


Cheers,
Jamie
jamie.osborn@foxite.com

ENTIRE THREAD

Updateable Cursor problem Posted by aktayal @ 10/2/2002 8:43:13 PM
RE: Updateable Cursor problem Posted by Jamie Osborn @ 10/3/2002 1:19:04 AM
Correction :) Posted by Jamie Osborn @ 10/3/2002 1:20:19 AM
RE: Correction of Correction:) Posted by Jamie Osborn @ 10/3/2002 1:22:33 AM
RE: Correction of Correction:) Posted by aktayal @ 10/4/2002 8:27:26 AM