kerrin Posted November 28, 2002 Share Posted November 28, 2002 Hey there, I have created a field definition that tells me too many seperators and i was wondering how many and clauses can you put in a Case. Or am i doing something else wrong.....Here it is: [color:"red"] * Note, if i take out the section in red, it works. But i need it in there help!! If(cLineItemType = "Product", Case(ProductStatus = "Reserved",1, [color:"red"] Left(max(ProductLineInvoice::cInstockCheck,1) = 1 and max(ProductLineInvoice::cInstockCheck) <> cInstockCheck and Products Current Bypass::ProductUpsell = "Yes" and Quantity <= Products::StockSelection and CQuantityTotal <> CQuantityCount,1, Quantity <= Products::StockSelection and CQuantityTotal <> CQuantityCount,1, 0),1) Regards, Kerrin Link to comment Share on other sites More sharing options...
andygaunt Posted November 28, 2002 Share Posted November 28, 2002 Well, not sure why you are trying to place a Case inside an IF statement. And the too many seperators is in reference to the , You can do all this inside the Case statement. so start with case Case( Criteria1, result 1, Criteria 2, result 2, Criteria 3, Result 3 etc ) Link to comment Share on other sites More sharing options...
kerrin Posted November 28, 2002 Author Share Posted November 28, 2002 Hi, thanks for looking but i worked it out. I was missing a ) on the following line before the comma..... silly me. Left(max(ProductLineInvoice::cInstockCheck,1) Regards, Kerrin If(cLineItemType = "Product", Case(ProductStatus = "Reserved",1, Left(max(ProductLineInvoice::cInstockCheck,1) = 1 and max(ProductLineInvoice::cInstockCheck) <> cInstockCheck and Products Current Bypass::ProductUpsell = "Yes" and Quantity <= Products::StockSelection and CQuantityTotal <> CQuantityCount,1, Quantity <= Products::StockSelection and CQuantityTotal <> CQuantityCount,1, 0),1) PS. I put the case statement inside the If statement so save adding and cLineItemType = "Product" to every case Link to comment Share on other sites More sharing options...
LiveOak Posted November 28, 2002 Share Posted November 28, 2002 You have not quite "worked it out" to good programming practice until you lose the if statement. -bd Link to comment Share on other sites More sharing options...
kerrin Posted November 28, 2002 Author Share Posted November 28, 2002 Hi, Can you suggest a better way? What i want is If(cLineItemType = "Product", Then do all these case things....... Case(ProductStatus = "Reserved",1, Left(max(ProductLineInvoice::cInstockCheck,1) = 1 and max(ProductLineInvoice::cInstockCheck) <> cInstockCheck and Products Current Bypass::ProductUpsell = "Yes" and Quantity <= Products::StockSelection and CQuantityTotal <> CQuantityCount,1, Quantity <= Products::StockSelection and CQuantityTotal <> CQuantityCount,1, 0), otherwise return the value 1 It seems logical to me. Kerrin Link to comment Share on other sites More sharing options...
djgogi Posted November 28, 2002 Share Posted November 28, 2002 case stops evaluating after first match so... Case(cLineItemType != "Product",1,ProductStatus = "Reserved",1, Left(max(ProductLineInvoice::cInstockCheck,1) = 1 and max(ProductLineInvoice::cInstockCheck) <> cInstockCheck and Products Current Bypass::ProductUpsell = "Yes" and Quantity <= Products::StockSelection and CQuantityTotal <> CQuantityCount,1, Quantity <= Products::StockSelection and CQuantityTotal <> CQuantityCount,1, 0) is prefered solution Dj Link to comment Share on other sites More sharing options...
Tintagel Posted November 28, 2002 Share Posted November 28, 2002 I'd take it that the "!=" in the above is meant to refer to the < > or not-equal-to operator?! Alternative would be - Case(not LineItemType = "Product",1, ...etc Link to comment Share on other sites More sharing options...
djgogi Posted November 28, 2002 Share Posted November 28, 2002 yes != mean not equal I've typed directly cLineItemType != "Product", while the rest was copy and paste from post I was replying Dj Link to comment Share on other sites More sharing options...
kerrin Posted November 28, 2002 Author Share Posted November 28, 2002 I C Now! it is all becoming clear Only had to change the ! = on the first line to <> but besides that it works. Thanks. Case(cLineItemType <> "Product",1,ProductStatus = "Reserved",1, Left(max(ProductLineInvoice::cInstockCheck,1) = 1 and max(ProductLineInvoice::cInstockCheck) <> cInstockCheck and Products Current Bypass::ProductUpsell = "Yes" and Quantity <= Products::StockSelection and CQuantityTotal <> CQuantityCount,1, Quantity <= Products::StockSelection and CQuantityTotal <> CQuantityCount,1, 0) Link to comment Share on other sites More sharing options...
JenMorley Posted November 29, 2002 Share Posted November 29, 2002 Where djukic comes from, "!=" probably has widely understood meaning. It can be hard to follow, when things are written in a way that is not how they appear in FileMaker. Some of us are just ordinary folks, though, and we need things explained. I guess that's why we are visiting the forum in the first place. Thanks to Tintagel I think I understand too, now! Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 7954 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now