Hi all,
Fisrt of all: i'm a starter working with iLogic, forms and rules.
I'm trying to make a rule to force users to fill in certain iProperties before saving.
Looking around on the internet I found a rule that works fine, except it checks only for empty spaces, so doesn't show up if they are filled.
What I want, is to edit the rule so that the form always shows when saving, but still pops up when the user has an empty space but hits ok. Just so people are made aware of what they filled in in the first place.
Code:
Manager = iProperties.Value("Summary", "Manager") Desc = iProperties.Value("Project", "Description") Partnr = iProperties.Value("Project", "Part Number") Keywords = iProperties.Value("Summary", "Keywords") Engineer = iProperties.Value("Project", "Engineer") Scale = iProperties.Value("Custom", "Scale") Descr1 = iProperties.Value("Custom", "Descr1") Drwnr = iProperties.Value("Custom", "Drawing number") Do Until String.IsNullOrWhiteSpace(Manager) = False And String.IsNullOrWhiteSpace(Desc) = False And String.IsNullOrWhiteSpace(Partnr) = False And String.IsNullOrWhiteSpace(Keywords) = False And String.IsNullOrWhiteSpace(Engineer) = False And String.IsNullOrWhiteSpace(Scale) = False And String.IsNullOrWhiteSpace(Descr1) = False And String.IsNullOrWhiteSpace(Drwnr) = False iLogicForm.Show("iPropchecker", FormMode.Modal) Manager = iProperties.Value("Summary", "Manager") Desc = iProperties.Value("Project", "Description") Partnr = iProperties.Value("Project", "Part Number") Keywords = iProperties.Value("Summary", "Keywords") Engineer = iProperties.Value("Project", "Engineer") Scale = iProperties.Value("Custom", "Scale") Descr1 = iProperties.Value("Custom", "Descr1") Drwnr = iProperties.Value("Custom", "Drawing number") Loop
Thanks
Solved! Go to Solution.
Solved by Vladimir.Ananyev. Go to Solution.
Dear lex brink,
Let's try the following idea. It uses the combination of the main rule and the user form.
User form is used to fill iProperites values. Main rule “Fill iProps” calls the form and then tests iProperties if they meet your requirements. If not then the main rule shows form again until the end user fills iProperties.
You should add event triggers “Before Save Document” and “Close Document” to your rule.
'Main Rule “Fill iProps” 'fills iProperties Dim OK As Boolean = False 'required 1st call iLogicForm.Show("Edit iProperties", FormMode.Modal) Do Dim Descr As String = iProperties.Value("Project", "Description") Dim CustomProp As String = iProperties.Value("Custom", "AAA") If (Trim(Descr) = "") Or (Trim(CustomProp) = "") Then MsgBox("Empty iProperties are not allowed") iLogicForm.Show("Edit iProperties", FormMode.Modal) Else OK = True End If Loop Until OK MsgBox("iProperties test is successful")
Function Trim() is used to avoid spaces in user input.
Sample part with rule and form is attached.