Examples for FormulaGuidelineCheck

Example 1: Print a message if performing FormulaGuidelineCheck on a formula FORMULA\0001 is successful and returns a non-empty data set

The below action gets the result data set by executing the FormulaGuidelineCheck method on FORMULA1\0001 object on the FGUIDELINE symbol with different Item, Technical Parameters, Status, Context options and prints the output message.
Option Strict Off
Imports System
Imports System.Diagnostics
Imports System.Collections.Generic
Imports System.Data


Class ActionScript
Inherits FcProcFuncSetEventWF

Function wf_start() As Long

         Dim guidelineCheckOptions As new Dictionary(Of String, String)
         guidelineCheckOptions.Add("SHOWITEMIND", "1")
         guidelineCheckOptions.Add("ITEMPCTIND","1")
           guidelineCheckOptions.Add("ITEMMISSINGSTMTIND","1")
           guidelineCheckOptions.Add("ITEMSHOWINFOSTMTIND","0")
           guidelineCheckOptions.Add("SHOWTPIND","1")
           guidelineCheckOptions.Add("TPMISSINGSTMTIND","0")
           guidelineCheckOptions.Add("TPSTATSIND","0")

           Dim contextOptions As new Dictionary(Of String, Object)
           contextOptions.Add("SELLOCATION",{"1", ""})
           contextOptions.Add("PRODTYPE",{"0", ""})
           contextOptions.Add("BRAND",{"1", "Default Brand"})

           Dim result As DataSet = FormulaGuidelineCheck("FORMULA1\0001", guidelineCheckOptions, contextOptions)

           If result IsNot nothing
	MessageList("Result has Data")
           Else
	MessageList("Result has No Data")
           End If

Return 1

End Function
End Class

Example 2: Displaying the Guideline Check result for Items only

The below action gets the result data set by executing the FormulaGuidelineCheck method on current object with different Item, Technical Parameters, Status, Context options and displays the Guideline result for items only.

Option Strict Off
Imports System
Imports System.Diagnostics
Imports System.Collections.Generic
Imports System.Data


Class ActionScript
Inherits FcProcFuncSetEventWF

Function wf_start() As Long

         Dim guidelineCheckOptions As new Dictionary(Of String, String)
         guidelineCheckOptions.Add("SHOWITEMIND","1")
         guidelineCheckOptions.Add("ITEMPCTIND","0")
         guidelineCheckOptions.Add("ITEMMISSINGSTMTIND","1")
         guidelineCheckOptions.Add("ITEMSHOWINFOSTMTIND","1")
         guidelineCheckOptions.Add("SHOWTPIND","0")
         guidelineCheckOptions.Add("TPVALIND", "0")

         Dim contextOptions As new Dictionary(Of String, Object)
         contextOptions.Add("SELLOCATION", {"0", ""})
         contextOptions.Add("MFGLOCATION", {"1", ""})
         contextOptions.Add("PRODTYPE", {"0", ""})
         contextOptions.Add("BRAND", {"1", ""})

         Try
                  Dim Result As DataSet = FormulaGuidelineCheck("" , guidelineCheckOptions, contextOptions)

                  Dim grResultText As String = ""
                  If Result Is Nothing Then
	   MessageList("No G&R Results returned")
                  Else

	Dim grResults As DataTable = Result.Tables("FSFGUIDELINERESULT")

	For Each grResultRow As DataRow In grResults.Rows
	        Dim grResultTxt As String = grResultRow("STDSTMTTXT")
	        Dim grResultItem As String = grResultRow("OBJCODE")
	        Dim grResultItemName As String = grResultRow("OBJDESCRIP")
	            grResultText + = grResultItem + " / " + grResultItemName + " = " + grResultTxt + System.Environment.NewLine
	Next

                  End If

                  If grResultText = "" Then grResultText = grResultText + "No Guideline Results Returned"
                  MessageList("G&R Check Results for Items: ", grResultText)

          Catch ex As Exception

          End Try

End Function
End Class

Example 3: Displaying the Guideline Check result for Parameters only

The below action gets the result data set by executing the FormulaGuidelineCheck method on current object on the with different Item, Technical Parameters, Status, Context options and displays the Guideline Result for Parameters only.

Option Strict Off
Imports System
Imports System.Diagnostics
Imports System.Collections.Generic
Imports System.Data


Class ActionScript
Inherits FcProcFuncSetEventWF

Function wf_start() As Long

         Dim guidelineCheckOptions As new Dictionary(Of String, String)
         guidelineCheckOptions.Add("SHOWITEMIND","0")
         guidelineCheckOptions.Add("ITEMPCTIND","0")
         guidelineCheckOptions.Add("SHOWTPIND","1")
         guidelineCheckOptions.Add("TPVALIND", "0")
         guidelineCheckOptions.Add("TPMISSINGSTMTIND","1")

         Dim contextOptions As new Dictionary(Of String, Object)
         contextOptions.Add("SELLOCATION", {"0", ""})
         contextOptions.Add("MFGLOCATION", {"1", ""})


         Try
                  Dim Result As DataSet = FormulaGuidelineCheck("" , guidelineCheckOptions, contextOptions)

                  Dim grResultText As String = ""
                  If Result Is Nothing Then
	   MessageList("No G&R Results returned")
                  Else

	Dim grResults As DataTable = Result.Tables("FSFGUIDELINERESULTPARAM")

	For Each grResultRow As DataRow In grResults.Rows
	        Dim grResultTxt As String = grResultRow("STDSTMTTXT")
	        Dim grResParam As String = grResultRow("OBJCODE")
	        Dim grResParamName As String = grResultRow("OBJDESCRIP")
	            grResultText + = grResParam + " / " + grResParamName + " = " + grResultTxt + System.Environment.NewLine
	Next

                  End If

                  If grResultText = "" Then grResultText = grResultText + "No Guideline Results Returned"
                  MessageList("G&R Check Results for Parameters: ", grResultText)

          Catch ex As Exception

          End Try

End Function
End Class 

Example 4: Displaying the Guideline Check result for both Items and Parameters

The below action gets the result data set by executing the FormulaGuidelineCheck method on current object on the with different Item, Technical Parameters, Status, Context options and displays the Guideline result for Item and Parameters.

Option Strict Off
Imports System
Imports System.Diagnostics
Imports System.Collections.Generic
Imports System.Data


Class ActionScript
Inherits FcProcFuncSetEventWF

Function wf_start() As Long

         Dim guidelineCheckOptions As new Dictionary(Of String, String)
         guidelineCheckOptions.Add("ITEMMISSINGSTMTIND","1")
         guidelineCheckOptions.Add("TPMISSINGSTMTIND","1")
         
         Dim contextOptions As new Dictionary(Of String, Object)
         contextOptions.Add("BRAND", {"1", "Default Brand"})       

         Try
                  Dim Result As DataSet = FormulaGuidelineCheck("" , guidelineCheckOptions, contextOptions)

                  Dim grItemResText As String = ""
                  Dim grParamResText As String = ""

                  If Result Is Nothing Then
	   MessageList("No G&R Results returned")
                  Else

	   Dim grResultTxt As String = ""
	   Dim grResObjCode As String = ""
	   Dim grResultObjDesc As String = ""
                        Dim grResults As DataTable 
                        Dim grResultRow As DataRow

	   grResults = Result.Tables("FSFGUIDELINERESULT")
                        For Each grResultRow In grResults.Rows
	       grResultTxt = grResultRow("STDSTMTTXT")
	       grResObjCode = grResultRow("OBJCODE")
	       grResultObjDesc = grResultRow("OBJDESCRIP")
	       grItemResText + = grResObjCode + " / " + grResultObjDesc + " = " + grResultTxt + System.Environment.NewLine
	   Next

                         grResults = Result.Tables("FSFGUIDELINERESULTPARAM")
                         For Each grResultRow In grResults.Rows
	       grResultTxt = grResultRow("STDSTMTTXT")
	       grResObjCode = grResultRow("OBJCODE")
	       grResultObjDesc = grResultRow("OBJDESCRIP")
	       grParamResText += grResObjCode + " / " + grResultObjDesc + "=" + grResultTxt + System.Environment.NewLine
	    Next

                  End If

                  If grItemResText = "" and grParamResText = "" Then  MessageList("No Guideline Results Returned")
                  MessageList("G&R Check Results for Items: ", grItemResText)
                  MessageList("G&R Check Results for Parameters: ", grParamResText)

          Catch ex As Exception

          End Try

End Function
End Class

Example 5: Displaying the informational, non-informational guidelines for both Parameters and Items

The below action gets the result data set by executing the FormulaGuidelineCheck method on current object with different Item, Technical Parameters, Status, Context options and verifies whether the result record is an information or not on the basis of Information column value, appends to the respective message and prints the output message.

Option Strict Off
Imports System
Imports System.Diagnostics
Imports System.Collections.Generic
Imports System.Data


Class ActionScript
Inherits FcProcFuncSetEventWF

Function wf_start() As Long

         Dim guidelineCheckOptions As new Dictionary(Of String, String)
         guidelineCheckOptions.Add("SHOWITEMIND","1")
         guidelineCheckOptions.Add("ITEMPCTIND","1")
         guidelineCheckOptions.Add("ITEMMISSINGSTMTIND","1")
         guidelineCheckOptions.Add("ITEMSHOWINFOSTMTIND","1")
         guidelineCheckOptions.Add("SHOWTPIND","1")
         guidelineCheckOptions.Add("TPVALIND", "1")
         guidelineCheckOptions.Add("TPMISSINGSTMTIND","1")
         guidelineCheckOptions.Add("TPSHOWINFOSTMTIND","1")
         guidelineCheckOptions.Add("VALIND","0")

         Dim contextOptions As new Dictionary(Of String, Object)
         contextOptions.Add("SELLOCATION", {"1", ""})
         contextOptions.Add("MFGLOCATION", {"0", ""})
         contextOptions.Add("PRODTYPE", {"1", ""})
         contextOptions.Add("BRAND", {"0", ""})

         Try
                  Dim Result As DataSet = FormulaGuidelineCheck("" , guidelineCheckOptions, contextOptions)

                  Dim grItemResText As String = ""
                  Dim grParamResText As String = ""

                 If Result Is Nothing Then
	   MessageList("No G&R Results returned")
                 Else
	   Dim grResultTxt As String = ""
	   Dim grResObjCode As String = ""
	   Dim grResultObjDesc As String = ""
	   Dim grInfoFlag As String = ""
	   Dim grResults As DataTable 
   	   Dim grResultRow As DataRow

                        grResults = Result.Tables("FSFGUIDELINERESULT")
                        For Each grResultRow In grResults.Rows
	             grResultTxt = grResultRow("STDSTMTTXT")
	             grResObjCode = grResultRow("OBJCODE")
	             grResultObjDesc = grResultRow("OBJDESCRIP")
	             grInfoFlag = grResultRow("INFORMATION")
	             If grInfoFlag = 0 Then
	           	grItemResText + = "Restriction : " + grResObjCode + " / " + grResultObjDesc + " = " + grResultTxt +
	            	System.Environment.NewLine
	             Else
	            	grItemResText + = "Information : " + grResObjCode + " / " + grResultObjDesc + " = " + grResultTxt +
	            	System.Environment.NewLine
	              End If
	     Next  

	   grResults = Result.Tables("FSFGUIDELINERESULTPARAM")
                        For Each grResultRow In grResults.Rows
	             grResultTxt = grResultRow("STDSTMTTXT")
	             grResObjCode = grResultRow("OBJCODE")
	             grResultObjDesc = grResultRow("OBJDESCRIP")
	             grInfoFlag = grResultRow("INFORMATION")
	             If grInfoFlag = 0 Then
	           	grParamResText + = "Restriction : " + grResObjCode + " / " + grResultObjDesc + " = " + grResultTxt +
	            	System.Environment.NewLine
	             Else
	            	grParamResText + = "Information : " + grResObjCode + " / " + grResultObjDesc + " = " + grResultTxt +
	            	System.Environment.NewLine
	              End If
	     Next  	     
	End If

	If grItemResText = "" and grParamResText = "" Then  MessageList("No Guideline Results Returned")
                  	MessageList("G&R Check Results for Items: ", grItemResText)
                  	MessageList("G&R Check Results for Parameters: ", grParamResText)

       Catch ex As Exception

       End Try
End Function
End Class