Welcome to the COE Discussion Forum! 

 

To participate in the discussion forum, you must be logged in to the website.  If you forget your login information, please contact COE Headquarters at coe@coe.org or (800) 263-2255.

If you are new to the COE Discussion Forum and would like to participate, please register.

 

COE DISCUSSION FORUM
Subject: Expert Rule

You are not authorized to post a reply.   
Author Messages
MADAXE

11 Apr 2008 05:15 AM

 

The code below works upto the function, why is it that i cant use functions in an expert rule where the language is VB?  or am I doing something wrong?

Madaxe

 

Dim MyCATIA     As Application
Dim MyProdDoc   As ProductDocument
Dim MyProduct   As Product
Dim MyProducts  As Products
Dim MyParameters    As Parameters
Dim MyListParameter  As ListParameter
Dim MyList  As List
Dim MyListSize  As Integer
Dim Index       As Integer
Dim Counter As Integer
Dim Flag        As Integer

Set MyCATIA = CATIA
Set MyProdDoc = MyCATIA.ActiveDocument
Set MyProduct = MyProdDoc.Product
Set MyProducts = MyProduct.Products
Set MyParameters = MyProduct.Parameters

If MyParameters.Count > 0 Then

    For Index = 1 To MyParameters.Count

        If InStr(MyParameters.Item(Index).Name, "BOM_LIST" <> 0 Then

            Flag = 1

        End If

    Next

    If Flag = 0 Then

        Set MyList = MyParameters.CreateList("BOM_LIST"

    Else

        Flag = 0

    End If
   
Else

    Set MyList = MyParameters.CreateList("BOM_LIST"

End If

Flag = 0


Set MyListParam = MyParameters.Item("BOM_LIST"
Set MyList = MyListParam.ValueList
MyListSize = MyList.Count

DigDown MyList, MyListSize, MyProduct


Private Function DigDown(MyList, MyListSize, MyProduct)

Dim Index As Integer
Dim Flag As Integer
Dim MyProducts As Products

Set MyProducts = MyProduct.Products
Flag = 0

For Each Product In MyProducts

Set MyProduct = Product.ReferenceProduct

    If MyListSize > 0 Then


        For Index = 1 To MyListSize2

            If InStr(MyList.Item(Index).Name, Product.Name) <> 0 Then

                Flag = 1

            End If

        Next

        If Flag = 0 Then

            MyList.Add Product

        Else

            Flag = 0

        End If

    Else

        MyList.Add Product

    End If

DigDown MyList, MyListSize, MyProduct

Next

End Function

 

erculije

21 Apr 2008 07:53 AM
Hi Madaxe,

That's right that we can't use functions or subs in an expert rule written in VB language.
That's why we even don't declare a main sub in the begining of the code.

Regards

Jerome
You are not authorized to post a reply.
Forums > COE Forums > KBE > Expert Rule



ActiveForums 3.6

    

401 North Michigan Avenue, Chicago, IL 60611-4267 | (312) 321-5153 | (800) COE-CALL (U.S.)