Show specific Form based off custom iProperty

Show specific Form based off custom iProperty

kwilson_design
Collaborator Collaborator
301 Views
2 Replies
Message 1 of 3

Show specific Form based off custom iProperty

kwilson_design
Collaborator
Collaborator

Is there a way to have a specific iLogic Form display on screen based off the custom iProperty?

 

I've tried to write code for this but it doesn't appear to show the form or do anything. This is what I'm trying to achieve.

 

Dim oTemplateVersion As String = iProperties.Value("Custom", "ETO Template Version")
If oTemplateVersion Is "ETO Standard" = True Then
	iLogicForm.Show("ETO Standard Form")
	
ElseIf oTemplateVersion Is "ETO AVR Base Generator (Single Channel Design)" Or oTemplateVersion Is "ETO AVR Base Generator (Double Channel Design)" = True Then
	iLogicForm.Show("ETO Base Generator Form")

ElseIf oTemplateVersion Is "ETO AVR Base Assembly Generator" = True Then
	iLogicForm.Show("AVR Base Assembly Generator")

End If

 

Regards,
Kenny
If this post solved your issue please mark "Accept as Solution". It helps everyone...really!
0 Likes
Accepted solutions (1)
302 Views
2 Replies
Replies (2)
Message 2 of 3

ryan.rittenhouse
Advocate
Advocate
Accepted solution

Looks like you might be missing an argument for your iProperties vaule call. If you add the document object it should work. I also prefer select statements to elseif chains, but that's a personal preference. Give this a try:

 

Dim oTemplateVersion As String = iProperties.Value(ThisDoc.Document, "Custom", "ETO Template Version")
Dim formName As String

Select Case oTemplateVersion
	Case "ETO Standard"
		formName = "ETO Standard Form"
	Case "ETO AVR Base Generator (Single Channel Design)", "ETO AVR Base Generator (Double Channel Design)"
		formName = "ETO Base Generator Form"
	Case "ETO AVR Base Assembly Generator"
		formName = "AVR Base Assembly Generator"
	Case Else
		Throw New Exception("No form found for Template Version " & oTemplateVersion)
End Select

iLogicForm.Show(formName)

 

If this solved your problem, or answered your question, please click Accept Solution.
Message 3 of 3

kwilson_design
Collaborator
Collaborator

Ah perfect @ryan.rittenhouse I should have thought about cases instead of If/then/else statements. Much easier way to skin this cat. I made one slight tweak at the end since we use global forms but it worked perfectly with the edit. Thanks!

Dim oTemplateVersion As String = iProperties.Value(ThisDoc.Document, "Custom", "ETO Template Version")
Dim formName As String

Select Case oTemplateVersion
	Case "ETO Standard"
		formName = "ETO Standard Form"
	Case "ETO AVR Base Generator (Single Channel Design)", "ETO AVR Base Generator (Double Channel Design)"
		formName = "ETO Base Generator Form"
	Case "ETO AVR Base Assembly Generator"
		formName = "AVR Base Assembly Generator"
	Case Else
		Throw New Exception("No form found for Template Version " & oTemplateVersion)
End Select

iLogicForm.ShowGlobal(formName)

I changed it to 

 

 

Regards,
Kenny
If this post solved your issue please mark "Accept as Solution". It helps everyone...really!
0 Likes