Form fields with formula

Hello,

I am working on several forms and I have the need to have a formula added to fields adding and subtracting and sum. Is there a way to do that in Appian?

Thanks!

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    The short answer is "yes", but if you're not used to the particular nature of Appian's scripting language, then the functionality available might not always fit your prior expectations.  Usually the resolution of this boils down to tempering expectations against the functionality available (as you get used to working with it), and once again as always we're here to help when you have some examples (even if just generic use cases) to provide us here.

  • Thank you Mike!

    I have inserted a quick form where I have added some decimal form fields, hopefully this way will help to get more clarity of what I am trying to accomplish...

    Thank you!

    a!formLayout(
      label: "Form with formula fields",
      contents: {
        a!floatingPointField(
          label: "Capital",
          labelPosition: "ABOVE",
          value: ri!capital,
          saveInto: ri!capital,
          refreshAfter: "UNFOCUS",
          validations: {}
        ),
        a!floatingPointField(
          label: "(Gain) or Loss",
          labelPosition: "ABOVE",
          value: ri!gainLoss,
          saveInto: ri!gainLoss,
          refreshAfter: "UNFOCUS",
          validations: {}
        ),
        a!floatingPointField(
          label: "Market 1",
          labelPosition: "ABOVE",
          value: ri!market1,
          saveInto: ri!market2,
          refreshAfter: "UNFOCUS",
          validations: {}
        ),
        a!floatingPointField(
          label: "Market 2 (gain/loss)",
          labelPosition: "ABOVE",
          value: ri!market2,
          saveInto: ri!market2,
          refreshAfter: "UNFOCUS",
          validations: {}
        ),
        a!floatingPointField(
          label: "Income",
          labelPosition: "ABOVE",
          value: ri!income,
          saveInto: ri!income,
          refreshAfter: "UNFOCUS",
          validations: {}
        ),
        a!floatingPointField(
          label: "Total",
          labelPosition: "ABOVE",
          value: ri!total,
          saveInto: ri!total,
          refreshAfter: "UNFOCUS",
          validations: {}
        )
      },
      buttons: a!buttonLayout(
        primaryButtons: {
          a!buttonWidget(
            label: "Submit",
            submit: true,
            style: "PRIMARY"
          )
        },
        secondaryButtons: {}
      )
    )

  • Hello Mike,

    Please the code bellow. Hopefully, it will help to get more clarity on my issue.

    Thank you.

    a!formLayout(
      label: "Form with formula fields",
      contents: {
        a!floatingPointField(
          label: "Capital",
          labelPosition: "ABOVE",
          value: ri!capital,
          saveInto: ri!capital,
          refreshAfter: "UNFOCUS",
          validations: {}
        ),
        a!floatingPointField(
          label: "(Gain) or Loss",
          labelPosition: "ABOVE",
          value: ri!gainLoss,
          saveInto: ri!gainLoss,
          refreshAfter: "UNFOCUS",
          validations: {}
        ),
        a!floatingPointField(
          label: "Market 1",
          labelPosition: "ABOVE",
          value: ri!market1,
          saveInto: ri!market2,
          refreshAfter: "UNFOCUS",
          validations: {}
        ),
        a!floatingPointField(
          label: "Market 2 (gain/loss)",
          labelPosition: "ABOVE",
          value: ri!market2,
          saveInto: ri!market2,
          refreshAfter: "UNFOCUS",
          validations: {}
        ),
        a!floatingPointField(
          label: "Income",
          labelPosition: "ABOVE",
          value: ri!income,
          saveInto: ri!income,
          refreshAfter: "UNFOCUS",
          validations: {}
        ),
        a!floatingPointField(
          label: "Total",
          labelPosition: "ABOVE",
          value: ri!total,
          saveInto: ri!total,
          refreshAfter: "UNFOCUS",
          validations: {}
        )
      },
      buttons: a!buttonLayout(
        primaryButtons: {
          a!buttonWidget(
            label: "Submit",
            submit: true,
            style: "PRIMARY"
          )
        },
        secondaryButtons: {}
      )
    )

  • I am unable to answer here with code because my posts are constantly being flagged as abusive... It makes no sense. I will send you a private message if you do not mind.

  • 0
    Certified Lead Developer
    in reply to antoniom0004

    That's fine. 

    Also, regarding any of your comments/posts being flagged - my first tip is to always use the code box ("insert" -> "code") to include code in a posting, which I think you already know how to do.  And assuming that isn't working, send an email to community@appian.com to alert them that your comments are being flagged as false positives; I believe they'll be able to help with that issue.

  • 0
    Certified Lead Developer
    in reply to antoniom0004

    Looks like your previous attempted comments have been un-flagged, btw.

  • I was told that the think including the labelPosition: "ABOVE", refreshAfter: "UNFOCUS", and validations: {} in every component in my code flagged the text repetition rules.