Fit Fam example forms

Certified Lead Developer

HI,

I want to expand the drop down list of available forms in the Fit Fam application, to include some of own interfaces.

This is currently driven by the expression rule FFM_formNamePairs, which is essentially a succession of if statements

e.g. 

if(exact(ri!formName,"Component Mix"),rule!FFM_testForm1(),
if(exact(ri!formName,"Company Information"),rule!FFM_testForm2(), 
if(exact(ri!formName,"The Bird Nest"),rule!FFM_testForm3(),
if(exact(ri!formName,"Picker Field Test"),rule!FFM_testForm4(),
if(exact(ri!formName,"User & Grids"),rule!FFM_testForm5(), 
if(exact(ri!formName,"Person Entry"),rule!FFM_testForm6(),

This does not seem to be particularly scalable, so I was wondering if anyone has come up with an alternative to populate the drop down, that includes the ability to to pass rule inputs into the form. 

Also note the above expression will return a FormLayout (System Type) data type.

 

Thanks

  Discussion posts and replies are publicly visible

Parents
  • You can use a displayvalue() and/or choose() and/or wherecontains() to accomplish this. Here is an example:

    with(
    local!names: touniformstring({
    "APP Form 1",
    "APP Form 2",
    "APP Record Summary",
    "APP Related Action",
    }),
    if(
    rule!APN_isBlank(
    ri!formName
    ),
    local!names,
    if(
    contains(
    local!names,
    ri!formName
    ),
    choose(
    wherecontains(
    ri!formName,
    local!names
    ),
    rule!FFM_test_APP_form1(),
    rule!FFM_test_APP_form2(),
    rule!FFM_test_APP_recordSum(),
    rule!FFM_test_APP_relAct()
    ),
    {}
    )
    )
    )

    The benefit of the if() statements is that you do not have to keep the arrays of names in the same order or even the same length. You can move a different name to be the first item without reordering the list of interfaces. You can also comment out one of the names without updating the interface if() statements. Both methods have benefits and drawbacks, but either works.

    As for passing inputs, maintaining those values inside of this rule will become unmanageable. The recommended approach here is to create a wrapper rule (note that in the example above rule!FFM_test_APP_form1() is a FFM rule that wraps an underlying APP rule) that handles passing rule input values. It requires creating rules, but since each form can have dozens of rule inputs, I have found this the best way to handle this.
  • 0
    Certified Lead Developer
    in reply to Steven Miccile
    Gentlemen, thank you for your replies. There is obviously a trade off between writing the wrapper rules and speeding up the development of the fitnesse scripts and just writing the fitnesse scripts from scratch.
Reply Children
No Data