Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

List of sales from Project

Hi Devnet.

I'm trying to use the .COM API, and I want to count how many sales that belong to a certain project.

I've managed to get it to work the other way around (receiving the project from the sale), but since I want my code to act different depending on if it is the first sale or not to a project, I need to be able to count the amount of sales allready existing.

What I can figure out from the database reference, it is possible to recieve a ActivityList from a project. But how do I determine whether or not, these ActivityListItems is sales, document or something other?

RE: List of sales from Project

Here is somehting to play with:

------------------ App.CurrentProject.ActivityList.vbs ------------------

Set app = CreateObject( "SuperOffice.Application" )
If Not app Is Nothing Then
    Set proj = app.CurrentProject
    Set actList = proj.GetActivityList( 4 )

    Set item = actList.GetFirst
    cnt = 0
    While Not item Is Nothing
        cnt = cnt + 1
        WScript.Echo item.Description
        Set it­em = actList.GetNext
    WScript.Echo "There were " & cnt & " sale items, visible to me, in this project"
    WScript.Echo "Error getting application object"
End If



Af: Conrad Weyns 7. apr 2017

RE: List of sales from Project

Hi Conrad.

Thank you for your reply. 

How does you make sure, that the items are sales items? Can't the items be other things besides sales?

Af: Kasper Rosenlund 20. apr 2017

RE: List of sales from Project

Hi Kasper,

That is what the 4 represents... sales.


Here is the documentation:

Hope this helps!

Af: Tony Yates 20. apr 2017