extreme Posted April 26, 2020 Posted April 26, 2020 Hello I need help please I have 3 buttons the following set fields button 1) set field [T50a_Samples::Morphology ; "Curly Silky"] button 2) set field [T50a_Samples::Morphology ; "Straight Sharp Glassy"] button 3) set field [T50a_Samples::Morphology ; "Straight Wiry"] What ever the field is set too I am trying auto set another field 1) T50a_Samples::Suggested_Material_Type ; "Cloth" 2) T50a_Samples::Suggested_Material_Type ; "Fabric" 3) T50a_Samples::Suggested_Material_Type ; "Leather" I have been on this for 3 days now so any help would be grateful Thank You
comment Posted April 26, 2020 Posted April 26, 2020 There are several ways you could approach this: Make your buttons run a script (instead of a single step) that sets both fields according to a script parameter sent by the button; Make the Suggested_Material_Type field a calculation field that uses the Case() function; Make the Suggested_Material_Type field a text field that auto-enters a calculated value, again using the Case() function. This is preferable if you want the user to be able to override the value. However, your description suggests that there is some kind of relationship between the values of a pair so that one is a subcategory of the other. In such case, it would be best to define a relationship to another table and display the related value from there.
extreme Posted April 26, 2020 Author Posted April 26, 2020 Hello thank you for your responce The fields are in the same table I have been washing videos and reading up on the Case() function but I still cant get my head around it. 3 days now I thought I could understand but with no joy. How would I go about creating the function please. Thank you
comment Posted April 26, 2020 Posted April 26, 2020 1 minute ago, extreme said: How would I go about creating the function please. it could be simply: Case ( Morphology = "Curly Silky" ; "Cloth" ; Morphology = "Straight Sharp Glassy" ; "Fabric" ; Morphology = "Straight Wiry" ; "Leather" ) 4 minutes ago, extreme said: The fields are in the same table I understand that. But it seems like they shouldn't.
extreme Posted April 26, 2020 Author Posted April 26, 2020 WOW thank you that worked perfect I cant believe that all the videos and reading I have done I couldn't work that out. Thank you very much
extreme Posted April 26, 2020 Author Posted April 26, 2020 Hi I hope you don't mind me asking but if I wanted to select several fields to generate the answer ie: Morphology = "Curly Silky" ; Cargile_Liquid = "1:550" ; Fibre_Colour = "White / Off White" ; Pleochroism = "None" ; Birefringence = "Low" ; Angle_of_Extinction = "Complete Parallel" ; Sign_of_Elongation = "Slow / Positive" ; Dispersion_Straining = "Blue Purple / Magenta" ; So if I choose multiple fields like above how can I populate the field with (Cloth or Leather) I hope you don't mind me asking ?
comment Posted April 26, 2020 Posted April 26, 2020 I am afraid you have lost me at this point. A calculation field returns a single result (output). The result can be calculated using several fields as the input. I am not sure what all those fields in your example are. If they are input, you can combine the conditions using logical operators such as AND and OR - for example: Case ( Light = "Red" and Police = "Present" ; "Stop" ; Light = "Green" or Police = "Absent" ; "Go" ; // and so on ) But such calculation can quickly become too long and difficult to maintain. It might be better to use nested Case() statements to emulate a decision tree.
extreme Posted April 26, 2020 Author Posted April 26, 2020 Hello I know it's confusing These are the fields Morphology Fibre_Colour Pleochroism Birefringence Angle_of_Extinction Sign_of_Elongation Dispersion_Straining and this is the data in the fields "Curly Silky" "1:550" "White / Off White" "None" "Low" "Complete Parallel" "Slow / Positive" "Blue Purple / Magenta" So the Suggested_Material_Type above will be (cloth) and the Suggested_Material_Type below will be (leather) "Straight Sharp Glassy" "1:670" "Brown / Off White" "None" "Moderate" "Complete Parallel" "Slow / Positive" "Blue Purple" I have 8 types of Material with different data in the fields so what ever I choose in the field it will give the result ?? Sorry for all the confusion I really appreciate the help Thank You
comment Posted April 26, 2020 Posted April 26, 2020 (edited) 1 hour ago, extreme said: I have 8 types of Material with different data in the fields You have 8 types of material, but does each material have only a single combination of the values in the 7 input fields? If yes, write a Case() statement with 8 tests, where each test is a combination of 7 predicates: Case ( Morphology = "Curly Silky" and Fibre_Colour = "1:550" and Pleochroism = "White / Off White" and Birefringence = None" and Angle_of_Extinction = Low" and Sign_of_Elongation = "Complete Parallel" and Dispersion_Straining = "Blue Purple / Magenta" ; "Cloth" ; Morphology = "Straight Sharp Glassy" and ............ and Dispersion_Straining = "Blue Purple" ; "Leather" ; // ... 6 more tests here ... ) There may be a shorter way of writing this, but the principle is the same. Edited April 26, 2020 by comment
Recommended Posts
This topic is 1744 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