The entered VbScript Code appears as --- in the M-Files property and does not perform the operation.

Hello,

Dim HesaplananDeger
Dim value3475, value3343, value2786, value3045, value3468

value3475 = PropertyValues.SearchForProperty(3475).TypedValue.DisplayValue
value3343 = PropertyValues.SearchForProperty(3343).TypedValue.Value
value2786 = PropertyValues.SearchForProperty(2786).TypedValue.Value
value3045 = PropertyValues.SearchForProperty(3045).TypedValue.Value
value3468 = PropertyValues.SearchForProperty(3468).TypedValue.Value


If value3475 = "EVET" And value3343 > 0 Then
HesaplananDeger = FormatNumber((((value2786 + value3045 - value3468) / value3343) - 1) * 100, 0) & "%"
ElseIf value3343 = 0 And value2786 > 0 Then
HesaplananDeger = FormatNumber((value2786 / 1) * 100, 0) & "%"
Else
HesaplananDeger = Null
End If

3475 idli property list method 3343 idli number (real) 2786 idli number (full) 3045 idli number (full) 3468 number (real)


Parents
  • Try a little debugging. You can insert this after the first section to check whether your code gets the values as desired:

    Err.Raise mfscriptcancel, value3475 &", "& value3343 &", "& value2786 &", "& value3045 &", "& value3468

    If that shows that your variable have the correct values you can go on and insert "Err.raise mfscriptcancel, HesaplananDeger" lines in the IF section to see whether your code there acts as expected.
    Assuming your script goes into Calculated value (VBScript) on the property definition, Automatic Values configuration you would need to end the code with

    Output = HeasplananDeger

    And of course the property must be configured as a text property to accept the output.

Reply
  • Try a little debugging. You can insert this after the first section to check whether your code gets the values as desired:

    Err.Raise mfscriptcancel, value3475 &", "& value3343 &", "& value2786 &", "& value3045 &", "& value3468

    If that shows that your variable have the correct values you can go on and insert "Err.raise mfscriptcancel, HesaplananDeger" lines in the IF section to see whether your code there acts as expected.
    Assuming your script goes into Calculated value (VBScript) on the property definition, Automatic Values configuration you would need to end the code with

    Output = HeasplananDeger

    And of course the property must be configured as a text property to accept the output.

Children
No Data