Skip to main content
replaced http://sharepoint.stackexchange.com/ with https://sharepoint.stackexchange.com/
Source Link
Source Link

InfoPath Conditional Arguments

I am developing a form in InfoPath to publish to Sharepoint 2010 that will have to do some calculations based on inputs. I am trying to set the value of one field based on the input from 2 option button fields. The problem is there are too many conditions too accomplish this with rules. How can I achieve this with code (C#/VB) in InfoPath Designer?

    If [Field1] = 1 AND [Field2] <4 1 THEN [ResultField] = 30
    ELSE IF [Field1] = 1 AND [Field2] = 4 THEN [ResultField] = 20
        ELSE IF [Field1] = 1 AND [Field2] = 5 THEN [ResultField] = 70
            ELSE IF [Field1] = 2 AND [Field2] <4 THEN [ResultField] = 25
                ELSE IF [Field1] = 2 AND [Field2] = 4 THEN [ResultField] = 15
                    ELSE IF [Field1] = 2 AND [Field2] = 5 THEN [ResultField] = 60
                        ELSE IF [Field1] = 3 AND [Field2] <4 THEN [ResultField] = 25
                            ELSE IF [Field1] = 3 AND [Field2] = 4 THEN [ResultField] = 15
                                ELSE IF [Field1] = 3 AND [Field2] = 5 THEN [ResultField] = 60
                                    ELSE IF [Field1] = 4 AND [Field2] <4 THEN [ResultField] = 20
                                        ELSE IF [Field1] = 4 AND [Field2] = 4 THEN [ResultField] = 10
                                            ELSE IF [Field1] = 4 AND [Field2] = 5 THEN [ResultField] = 50
                                                ELSE IF [Field1] = 5 AND [Field2] <4 THEN [ResultField] = 15
                                                    ELSE IF [Field1] = 5 AND [Field2] = 4 THEN [ResultField] = 10
                                                        ELSE IF [Field1] = 5 AND [Field2] = 5 THEN [ResultField] = 50;

I found this answer InfoPath Calculated Value

which is close to what I think I need.