Forum Discussion

Nikpowar97's avatar
Nikpowar97
Contributor
7 months ago

Disallow invalid Entry in forms

Is there any way I Can enter a +ve or -ve value based on the text property if a Flow member in a form. I think a Save Data Event Handler can, but I will throw an error if the only after the form is...
  • MarcusH's avatar
    7 months ago

    SaveDataEventHandler is not recommended for this as it executes everywhere. You can use it to abort a save and pop up an error but there are other options. You could potentially use a FormsEventHandler and that can be used to stop the save. Alternatively you can use formatting on the CV to indicate that the value entered is incorrect (eg change the background colour to Red). It does not stop the save though. The problem you have is the +ve/-ve indicator is in a text field against the Flow member. For that you will need to use an XFBR.

    The format of the XFBR call will be like this: XFBR(BRRuleName, FunctionNameInBR, FlowMember). The XFBR returns the text member for the passed in FlowMember - the formatting below assumes the Text field contains POS or NEG. You then add this as the format instruction:

    If CellAmount < 0 And (XFBR(BBRuleName, FunctionNameInBR, FlowMember) Contains POS) Then
        BackgroundColor = Red
    Else If CellAmount > 0 And (XFBR(BBRuleName, FunctionNameInBR, FlowMember) Contains NEG) Then
        BackgroundColor = Red
    Else
        BackgroundColor = White
    End If

    The problem is making it dynamic. If you are happy to hardcode the Flow member into every format it's not a problem. I haven't been able to access the POV members to pass through to the XFBR. The system variables do not seem to work all the time eg the variable MFFlow only works for a Member Filter (and I couldn't get that to work). You can access the Cube POV variables but that will vary from user to user. If you could identify which Flow members need to be +ve or -ve based on the name you could use RowE1MemberName instead of the XFBR.

    I hope that helps.

    Marcus

  • DeanHarper's avatar
    7 months ago

    This is quite straightforward I think.  If you create a dynamic Ud8 member that checks if the value of the POV data intersection is in keeping with the +ve/-ve you expect based upon the text property.

     Return say a 1 if it is in keeping and a 2 if it is incorrect, then hide that column but use it as the basis for conditional formatting the row, or in the case of one of my clients we have nice graphical color blobs, because these are dynamic they flag as soon as the unexpected value is populated.