Jump to content

Need help with Iron Python script for validation on input box in spotfire


Shaibaz Antule

Recommended Posts

Hi,

I have created an input box for showing only entered no. of days data into the report. The report holds data only for last 14 days from the current date.

But, currently when user is entering a value more than 14 in the input box, it is still showing the data in the report. I want to give a validation on this input box.

If user enters value >14 or =DateAdd('day',-${NumberOfDays},DateTimeNow())

Also, attached is the snapshot for the input box created.

 

Please help if this is possible.

Thank you!

Link to comment
Share on other sites

You can attach a IronPython script to the document Property "NumberOfDays" which validates the input value and executed when ever the document property changes.

You can add a script to the property as follows,

Goto Edit - Document Properties - properties tab- select the document property- on the right select script - select the radio button "execute the script selected below" and add the below script

 

import clr

import System

clr.AddReference("System.Windows.Forms")

from System.Windows.Forms import MessageBox

 

days=Document.Properties["NumberOfDays"]

 

if days14:

Document.Properties["NumberOfDays"]=0 ;

MessageBox.Show("Enter a valid value between 0 and 14")

Link to comment
Share on other sites

  • 1 year later...

I am getting this error when I save it as library item and open weblink.

Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

How to avoid this error

Thanks

Amol

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...