ruthcarlton Posted June 27, 2002 Posted June 27, 2002 Is there a way to write a caluclation where a field CONTAINS, as opposed to equals? I would like to have a calculation based on data from check boxes where I have multiple possibilites and I can only get it to work with radio buttons where there is only one possibility.
The Bridge Posted June 27, 2002 Posted June 27, 2002 Use the PatternCount(text, search string) function. This returns the number of instances of search string in text, which could be a field or a static text value inside quotation marks.
ruthcarlton Posted June 27, 2002 Author Posted June 27, 2002 Thanks for your response, but I'm not sure it will help... I have a daily sales DB, with sales of merch item. Each merch item has a product description. The product descriptions are in a value list from another file which will be edited often. There is a daily fee which is calculated based on whether the product description is clothing or nonclothing. Each day the defenition of clothing and nonclothing may change. What I have been trying to do is allow the user to check which product description will be considered clothing that day and use those values in the fee calculation. If(tour::clothing=productdescription, total, "0") This calculation only works if there is one productdescripttion chosen, if there are 2 or more, it doesn't recognize any.
The Bridge Posted June 27, 2002 Posted June 27, 2002 Is Tour::Clothing a global field that has your Product Description value list attached to it? If so, then perhaps this will work instead of your current calculation: Case (PatternCount (Tour::Clothing, ProductDescription) > 0, total, 0) Otherwise, I think I need more information on how your system is set up.
ruthcarlton Posted June 28, 2002 Author Posted June 28, 2002 clothing is not a global field. Maybe if I explain my work-around, it will make more sense. Currently I have individual check boxes for every item being sold to designate whether the item is clothing or non-clothing. I would like to the user to be able to choose which product descriptions are clothing or non-clothing rather than having to choose the individual item. I have been trying to do this with a field called "clothing" with check boxes for the product descriptions; Tshirts, hats, jackets, CDs (which are from another file and will be edited often), but as soon as I check more then 1 box, the calculation breaks.
djgogi Posted June 28, 2002 Posted June 28, 2002 If I have understood the question than if(isEmpty(Substitute (Substitute(Substitute(Substitute(Substitute...//the number of substitutes has to be hardcoced //(tour::clothing,MiddleWords(productdescription,1,1),""),MiddleWords(productdescription,2,1),""),MiddleWords(productdescription,3,1),""),MiddleWords(productdescription,4,1),"")...//also this part has to be hardcoced : //, "
The Bridge Posted June 28, 2002 Posted June 28, 2002 Okay, I think I get it. I think that you should apply your existing approach, i.e. indicating which individual items are clothing, to your product description file. In the Product Description file, define a number field called Is_Clothing; this field will contain a 1 if Yes, 0 if No. Then, you can build a relationship between Product Descriptions in your Daily Sales file to Product Descriptions in your Product Descriptions file and test to see if Is_Clothing is 1 or 0. If yes, then apply the fee. If no, then don't. As far as user interface is concerned, you can create a portal showing all records from Product Description, listing the Product Description itself and Is_Clothing. Is_Clothing can be formatted with a checkbox drawing from a valuelist that has just one value: 1. I hope this helps somewhat.
Recommended Posts
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