APS (Advanced Planning and Scheduling) Asprova APS

 
Home > FAQCOM
FAQ

COM

Search in FAQ:

Referencing or getting the added property of the user by COM

Q:Added "OrderUser_TEST" property in the Asptova order. Made it as the array type, and how to set or get it by COM

A:

We use the method called [LookupPropID]
in the rootobject to get the ID of the property. Use the ID we got ,use the "Set As Str"
to set the data and use the "GetAsStr"
to get the data.

For example use VB to set "LookupPropID", "SetAsStr", "GetAsStr" as follows
Dim propID As Long
Dim buf As Strung

propID = root.LookupPropID("OrderUser_TEST")
order.SetAsStr propID, 0, "123"
buf = order.GetAsStr(propID, 0).

※root is ASORootObject、and the order is ASBOrder. Get it from argList first.

Checking the number of the data of the added property of Array type user

Q:Added "OrderUser_TEST" property in the Asptova order. Made it as the array type, and how to check the number of the data speciied by COM

A:

We use the method called [PropertyValueCount]
in the rootobject to check the numbers.

For example use VB to set it as follows
Dim propID As Long
Dim numData As Long

propID = root.LookupPropID("OrderUser_TEST")
numData = root.PropertyValueCount(order, propID)

※root is ASORootObject、and the order is ASBOrder. Get it from argList first.
※LookupPropID is the method to get the ID of the property. See here about the LookupPropID.

How to do to make the window(gantt chat or the table ) which is open when be saved to be front

Q:Save the file which the load graph is opened.How to do to show the load graph in fornt by COM

A:

Check [RootWorkspace.ActiveProjectViews] from root object and you can see the windows which are opened(ASGViews).

There is amethod called [WindowCount]
in the [ActiveProjectViews] which can return the number of the opened windows.
Use it to find the target window.

The resource gantt chart ,load graph .etc can not be recognized from out side So, prepare property of ASGViews::Caption .etc which can recognize them.

If you use the ASGViews::Caption, the resource code is like the follow one
Dim ActiveWnd As AsLib.ASGViews
Dim ActiveWnd As AsLib.ASGViews

Set ActiveWnd = root.RootWorkspace.ActiveProjectViews
WndNum = ActiveWnd.WindowCount

 For i = 1 To WndNum
' Find the load graph.
If InStr(ActiveWnd.Window(i).Caption, "the load graph") <> 0 Then ActiveWnd.Window(i).MoveToFront ' show the window in front.

Now, the load graph will show in front at the caption
※Root Object is the ASORootObject and get it first.

Summarying the data of the load graph

Q:How to show the data of the load graph from COM

A:

There is amethod called ExportSummaryData in ASGTimeChartWindow class.
This method is used to ecport the data of the chart.
The format and the name of the exported file ,and the term type will be exported to the argument.

For example, try to export the width of row about 1 day in RDB format, use the follow.
Dim ratiograph as AsLib.ASGTimeChartWindow
Set ratiograph = root.RootWorkspace.ObjectWindow.Views.OpenNewLoadGraph

ratiograph.ExportSummaryData kChartFileFormat_RDB,strExportPath, kUnitTermType_1Day

Mennwhile the summary method can be specified by the data of LoadGraphSummaryMethod of the ASGTimeChartWindow class.
SummaryMethod: [TLoadGraphSummaryMethod]
None: [kLoadGraphSummaryMethod_None]
Average: [kLoadGraphSummaryMethod_Average]

※the root object is [ASORootObject]. Take it first.
※the pass of the export data should be specified in the [strExportPath first]
※The details of the function about the export format[TChartFileFormat] and the term type [TUnitTermType] can be found in the help

The programin cann't recognized by Asprova

Q:The programin cann't recognized by Asprova. Is something wrong

A:

The function that the error of the programin's autoregistration can be showed in a message is realsed from Ver.6.0.1.
From now on, the miss of the Autoregistration function can be knowed easily.Almost is the miss of the name of class and the function.
If the message is not be shoed ,check that if the account login in has a right of adminstrator .If the account whichout a right of adminstrator login in ,may cann't load the dll, or register the dll in the registry.
(this was noted in the Technical Notes.pdf already TN-C070626)

Set the position of the comment by the COM

Q:Right click at the left of the order gantt chat to make a programin which can make or delete a special comment to the order by VB6. (KeyPopupOnOrderGanttChartLeft)
Question①
make a comment 4 as test to the order without comment before execute the Add-in of the follow code

Dim pSelOrder As ASBOrder
Set pSelOrder = args.ArgAsObject(kArgOrder)
pSelOrder.Comment(4) = "test"

But the "test" comment is writen into the comment 1.Is the way of writing code is wrong.

A:

No,it is right.If you want to make a comment into the fourth one, please also make three comments with nothing like the follows.

 pSelOrder.Comment(0) = ""
 pSelOrder.Comment(0) = ""
 pSelOrder.Comment(0) = ""
 pSelOrder.Comment(4) = "test"

Deleting the comment by the COM

Q:There are 4 comments and when try to delete the comment 4,execute the Add-in of the follow code
Dim pSelOrder As ASBOrder
Set pSelOrder = args.ArgAsObject(kArgOrder)
pSelOrder.Comment(4) = ""
The Comment 4 is deleted. However, the whole comments became {comment1;comment2;comment3;} which still has";" after it.How to delete it

A:

Please do the follow Add-in to delete it

Dim utils As ASFUtility
Set utils = args.ArgAsObject(kArgUtility)
Dim result As Boolean
result = utils.Remove(prodTask, AsLib.kASBOrder_Comment, 4)