mjlongo Posted November 12, 2021 Share Posted November 12, 2021 (edited) Hello, I have a job where the customer supplies 5 fields. F1, F2, F3, F4 and F5. They will either contain a zero or they will contain a numeric value. I have to select the range from the fields and print that range of fields when they are not zero. Fields inside the range can contain a zero. So for example: F1=50, F2=100, F3=200, F4=300, F5=100: I print all fields. F1=0, F2=100, F3=200, F4=300, F5=100: I print fields F2 through F5. F1=50, F2=100, F3=0, F4=300, F5=0: I print fields F1 through F4. F1=0, F2=0, F3=200, F4=0, F5=100: I print fields F3 through F5. F1=0, F2=0, F3=200, F4=0, F5=0: I print only field F3. I'm pretty sure I can come up with a long list of if statements to handle this but I'm also sure there is a smarter way. Maybe using some kind of test on an array? Any ideas on how to handle this would be greatly appreciated. Thanks! Edited November 12, 2021 by mjlongo Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.