Wednesday, June 11, 2014

Placeholders on iLogic Forms

I recently had a case where a colleague was setting a custom iProperty (Program Number) to either the file name or a custom field and he was using a boolean parameter to determine which of these to use to set it.

Here is his original code:
'********************************************************
'Set Program Name

If Set_Prog_Name = True Then
    iProperties.Value("Custom", "Program Number") = ThisDoc.FileName(False) 'without extension
Else
    iProperties.Value("Custom", "Program Number") = ""
End If

'********************************************************
We can see from the original code that when Set_Prog_Name = False that the Program Number will be set to <blank>.  He needed a way to allow the end user to enter a value in the Program Number field.

My immediate response wast to set up an input box but he preferred to not have an additional dialog box.

The end solution was one to add a placeholder iProperty, which I called Program_Name_Temp, on the form in place of the original Program Number and set the value of the Program Name iProperty equal to the placeholder when Set_Prog_Name = False.  As an additional bonus, I added a controlling parameter for Program_Name_Temp which is called Set_Prog_Name_Controls.

'********************************************************
'Set Program Name

If Set_Prog_Name = True Then
    Set_Prog_Name_Controls = False
    iProperties.Value("Custom", "UserInfo2") = ThisDoc.FileName(False) 'without extension
    Program_Name_Temp = iProperties.Value("Custom", "Program Name")
Else
    Set_Prog_Name_Controls = True
    iProperties.Value("Custom", "Program Name") = Program_Name_Temp
End If

'********************************************************

I hope this helps you on a future or current project.

Randy

"Even if you're on the right track, you'll get run over if you just sit there ." - Will Rogers

No comments:

Post a Comment