Click or drag to resize

IDatabaseGetRelation Method

Get a Relation object. Return an error if the relation is hidden. If you call the GetRelation function with 0, it will create a new relation, like Database.CreateRelation

Namespace:  SuperOffice.COM.SuperOfficeDB
Assembly:  SuperOfficeDB.Interop (in SuperOfficeDB.Interop.dll) Version: 8.0.0.0
Syntax
SORelation GetRelation(
	int RelationId
)

Parameters

RelationId
Type: SystemInt32
the Id of the specific relation

Return Value

Type: SORelation
SORelation
Examples

Get the relation with id=1

This text may be copied to the notepad, and saved as a *.vbs file. Remember to change the login information.

VB
dim objso
set objso =  CreateObject("superofficedb.database")
If not (objSO is nothing) Then
    objso.login  "<username>", "<password>"
    set  objrelation = objso.getrelation(2)
    if objrelation.sourcetable = 5 then 'the  source of the relation is a company
        set cont =  objrelation.sourcerecord
        source = cont.name
    else 'the source of the relation is a  person, and source record would be 6
        set pers = objrelation.sourcerecord
        source = pers.firstname  & " " & pers.lastname & " from company " &  pers.contact.name
    end if
    if objrelation.targettable = 5 then
        set cont =  objrelation.targetrecord
        target = cont.name
    else
        set pers =  objrelation.targetrecord
        target = pers.firstname  & " " & pers.lastname & " from company " &  pers.contact.name
    end if
    msg = source & " "  & objrelation.activetext & " " & target & vbcrlf
    msgbox msg,,"relation with relation_id  = 1 is between:"
else
    msgbox "unable to connect to  database"
end if

See Also