# EsbGetAssociatedAttributesInfo

Description

EsbGetAssociatedAttributesInfo() returns any attribute information associated with a given base member.

Syntax

    EsbGetAssociatedAttributesInfo (hCtx, MbrName, AttrDimName, Count)

    ByVal hCtx        As Long
    ByVal MbrName     As String
    ByVal AttrDimName As String
          Count       As Long

Parameters

hCtx | Context handle
MbrName | Base member name
AttrDimName | (Optional) attribute dimension name
Count | Number of attribute members returned

Return Value

Returns sts = 0 when successful, otherwise returns an error number.

Notes

- This function retrieves more information for attribute members than EsbQueryDatabaseMembers().
- Set AttrDimName to NULL to return all attribute members that are associated with the base member.
- Optionally, provide an attribute dimension name to retrieve information only about the member of that dimension which is associated with the base member.
- After you call EsbGetAssociatedAttributesInfo(), call EsbGetNextItem(), using ESB_ATTRIBUTEINFO_T, to retrieve the attribute information structure(s) that you want.
- There are two situations where attribute information returned from this function might be invalid:
  1. In the Visual Basic API, the attribute data type of a given attribute dimension is derived from the data type of the attribute dimension's name. Because of this, attribute values might not be valid for attribute dimensions. Applications should ignore the value of the Attribute field in the returned ESB_ATTRIBUTEINFO_T structure if the name passed to EsbGetAssociatedAttributesInfo() is that of an attribute dimension. Test the MbrInfo.MbrName and MbrInfo.DimName fields to see if they are equal. If equal, they refer to a base dimension, and the attributes information should be ignored.
  2. Date attributes contain time information (a time stamp) that is automatically processed (has date math performed upon it) by Visual Basic. This could lead to invalid values for date attributes (depending upon the time zone specified in a given client machine). To avoid this automatic processing, use the attribute name as opposed to the attribute value when displaying the date attribute information.

Access

This function requires no special privileges.

Example

    Sub ESB_GetAssociatedAttributesInfo()
    	' NOTE: 'Out' is a sub to print the output within quotes to a listbox or text box.
    	Dim hCtx as long
    	Dim sts as long
    	Dim MbrName As String
    	Dim AttrDimName As String
    	Dim Count As Long
    	Dim Attribinfo As ESB_ATTRIBUTEINFO_T
    	Dim index As Integer
    	Dim tempstring As String

    	MbrName = InputBox("Base member name", "Base Member Name")
    	AttrDimName = InputBox("Attribute Dimension Name (Optional)", "Attribute Dimension Name")

    	sts = EsbGetAssociatedAttributesInfo(hCtx, MbrName, AttrDimName, Count)

    	If sts <> 0 Then
    		MsgBox "Error in ESB_GetAssociatedAttributesInfo: " & sts: Exit Sub
    	Else
    		tempstring = "...count = " & Count & "..."
    		out (tempstring)

    		Out "Associated Attr info for " & "[" & MbrName & "]"
    		Out "------------------------------------"

    		For index = 1 To Count
    			sts = EsbGetNextItem(hCtx, ESB_ATTRIBUTEINFO_TYPE, Attribinfo)
    			Out "Dim Name: " & Attribinfo.DimName
    			Out "Mbr Name: " & Attribinfo.MbrName

    		' NOTE: use of select case statement to discern (and act upon) type of attribute returned
    		Select Case VarType(Attribinfo.Attribute)
    			Case vbDouble
    				Out "Data Type    : Numeric(Double)"
    				Out "Data Value   : " & Attribinfo.Attribute
    				Out ""
    			Case vbBoolean
    				Out "Data Type    : Boolean"
    				Out "Data Value   : " & Attribinfo.Attribute
    				Out ""
    			Case vbDate
    				Out "Data Type    : Date"
    				 ' Suggested way to get Date Attribute value for display
    				Out "Data Value   : " & Attribinfo.DimName
    				Out ""
    			Case vbString
    				Out "Data Type    : String"
    				Out "Data Value   : " & Attribinfo.Attribute
    				Out ""
    				End Select
    				Out ""
    			Next index
    	End If
    End Sub

See Also

EsbCheckAttributes()
EsbGetAttributeInfo()
EsbGetAttributeSpecifications()
EsbOtlAssociateAttributeDimension()
EsbOtlAssociateAttributeMember()
EsbOtlDisassociateAttributeDimension()
EsbOtlDisassociateAttributeMember()
EsbOtlFindAttributeMembers()
EsbOtlGetAssociatedAttributes()
EsbOtlGetAttributeInfo()
EsbOtlGetAttributeSpecifications()
EsbOtlQueryAttributes()
EsbOtlSetAttributeSpecifications()