Question Re build an application step 9

I am re building the Dev training app and this is only thing I cannot get to work from the training guidance and I am not sure why.  I have rebuilt up to step 13 and every thing else and other tips have worked. 

On the add Vehicle form.

a tip is "TIP: Use the Visibility Setting to Conditionally Show Interface Components ● In some cases, you might want to display a component based on a condition. ● To do this, use the Visibility setting in the Component Configuration pane. Select Only Show When and enter an expression in the Expression Editor. ● For example, imagine that you want to display a Comments field if a vehicle’s mileage is above 150,000 miles. You can enter the expression ri!vehicle[recordType!AX Vehicle.fields.vehicleMileage] > 150000. ● This expression determines whether the Comments component is displayed on the interface. When set to false, the component is hidden and not evaluated. The default is set to true."

I have the following in

How ever I get the following message when I try this tip.

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!paragraphField [line 156]: Cannot compare incompatible operands of type Null and type Number (Integer).

The reference application in community does not have this tip in it so its hard to see why and I don't fully understand why following the tip is not working correctly. 

Any comments on how to fix it would be appreciated. 

  Discussion posts and replies are publicly visible

  • I don't have any clue which community course are you talking about, but it seems like there is no value saved in the vehicleMileage field of vehicle recordType and that's why it is throwing error that you are comparing null with integer number. Make sure that there is some value in vehicleMileage field and if the value in this field is saved from the current interface only, then you need to change the showWhen condition to handle the null value as well, like:

    and(
    a!isNotNullOrEmpty(ri!vehicle[recordType!AX Vehicle.fields.vehicleMileage]),
    ri!vehicle[recordType!AX Vehicle.fields.vehicleMileage] > 150000
    )

  • Its the Appian Developer training course and its the on the interface for adding a new vehicle so it is a blank form. The tip is meant to open a comments box if your asking to add a vehicle that would be classed as high mileage to the application. 

    I can confirm the above worked so thanks now I can feed back around the tip not taking into consideration the null value of the form until you actually go to add the vehicle to the application.

    I will configure a save value now. I understood not having it before meant the comment was not passed on in the process model. 

  • 0
    Certified Senior Developer
    in reply to aland3033

    Did you tried the showWhen code I provided above?

    Thanks for editing the above comment, yeah you need to save the comment in a field too

  • Sorry I did after the initial reply was trying to reply and speak to 5 Y/O at same time so did not fully read the answer but edited the initial reply

  • This is what I ended up with. just need to adjust process model to pass the info on now. 

    a!paragraphField(
    label: "Vehicle Comments",
    labelPosition: "ABOVE",
    helpTooltip: "Why should this high mileage vehicle be added to the fleet",
    saveInto: ri!vehicle['recordType[AX Vehicle.fields.vehicleAddcomment'],
    refreshAfter: "UNFOCUS",
    height: "MEDIUM",
    showWhen: and(
    a!isNotNullOrEmpty(ri!vehicle['recordType[AX Vehicle.fields.vehicleMileage']),
    ri!vehicle['recordType![AX Vehicle.fields.vehicleMileage'] > 150000
    ),
    validations: {}
    )

  • +1
    Certified Senior Developer
    in reply to aland3033

    You are not displaying the comment on the interface Cry

    pass the saveInto value in "value" parameter too.

    And please try this.

     

  • You spotted it faster than myself Sanchit.

    I was wondering why it did not display I then realised I had missed the value and was in the process of doing that when I had to step away.

    Below is what it shows now.

    a!paragraphField(
    label: "Vehicle Comments",
    labelPosition: "ABOVE",
    helpTooltip: "Why should this high mileage vehicle be added to the fleet",
    value: ri!vehicle['recordType!AX Vehicle.fields.vehicleAddcomment'],
    saveInto: ri!vehicle['recordType!AX Vehicle.fields.vehicleAddcomment'],
    refreshAfter: "UNFOCUS",
    height: "MEDIUM",
    showWhen: and(
    a!isNotNullOrEmpty(ri!vehicle['recordType!AX Vehicle.fields.vehicleMileage']),
    ri!vehicle['recordType!AX Vehicle.fields.vehicleMileage'] > 150000
    ),
    validations: {}
    )

    I am also happy to say I was able to trouble shoot why it was not showing on the supervisor form when running through the process model. 

    I was able to a amend the supervisor form with the following 

    a!paragraphField(
    label: "Vehicle Comments",
    labelPosition: "ABOVE",

    helpTooltip: "Only applicable if vehicle is classed as high mileage",
    value: a!defaultValue(
    ri!vehicle['recordType!AX Vehicle.fields.vehicleAddcomment'],
    "–"),
    saveInto: {},
    refreshAfter: "UNFOCUS",
    height: "MEDIUM",
    readOnly: true,
    validations: {}
    )
    },

    which results in the below.

    Thanks again for your suggestion & guidance on this.