Map service GetMapTableSubtypeInfos method

Gets an array of subtype information objects.

GetMapTableSubtypeInfos(string MapName, int[] TableIDs)

Parameter

Description

MapName

The name of the map (data frame) that contains the layer/table.

TableIDs

A list of layers/standalonetable ids for which subtype information will be returned.

Return Value

An array of MapTableSubtypeInfo objects, each containing information about a layer/standalonetable's subtype and domain.

Remarks

The function takes an array of standalonetable and layer ids. When this parameter is Nothing/Null, all layers and standalone tables are checked for subtypes. No object is returned for layers/tables whose HasSubtype is False. Use MapLayerInfo/StandaloneTableInfo to locate this property). Therefore, the count of input TableIDs may not match with the count of returned array. Use the MapTableSubtypeInfo. TableID to find which layer/table the object belongs to.

Each returned object contains information about all subtypes and domains assigned at subtype level. When a field is invisible, even though it may have domain assigned for a subtype, SubtypeInfo. FieldDomainInfos does not contain a FieldDomainInfo for that field.

This function returns an error message when the CodeCount of all CodedValueDomains from all layers and tables exceeds <MaxDomainCodeCount>.

NoteNote:

Subtypes and domains are not returned from joined tables.

Examples

C#

//In this example, it is assumed that a StandaloneTableInfo is passed in and a TreeView

//control named tvwSD is available on a form

TreeNode pNodeRoot = null;

TreeNode pNodeSubtypes = null;

TreeNode pNodeST = null;

TreeNode pNodeFieldDomains = null;

TreeNode pNodeFD = null;

TreeNode pNodeDomain = null;

 

IMapTableSubtypeInfo[] pMapTableSubtypeInfos = null;

IMapTableSubtypeInfo pMTSTInfo = null;

SubtypeInfo[] pSubtypeInfos = null;

SubtypeInfo pSTInfo = null;

FieldDomainInfo[] pFieldDomainInfos = null;

FieldDomainInfo pFDInfo = null;

CodedValueDomain pCVDomain = null;

RangeDomain pRDomain = null;

CodedValue pCV = null;

 

pStandaloneTableInfo = m_pMapServerInfoWSDL.StandaloneTableInfos[0];

if (!pStandaloneTableInfo.HasSubtype)

return;

pMapTableSubtypeInfos = m_pMapServer.GetMapTableSubtypeInfos(strMapName, new int[] {0});

pMTSTInfo = pSubtypeInfos[0];

if (pMTSTInfo == null)

return;

pNodeRoot = tvwSD.Nodes.Add(pStandaloneTableInfo.Name);

pNodeRoot.Nodes.Add("Subtype Field: " + pMTSTInfo.SubtypeFieldName);

pNodeRoot.Nodes.Add("Default Subtype Code: " + pMTSTInfo.DefaultSubtypeCode);

pSubtypeInfos = pMTSTInfo.SubtypeInfos;

pNodeSubtypes = pNodeRoot.Nodes.Add("Subtypes >>");

 

for (int i = 0; i < pSubtypeInfos.Length; i++)

{

pSTInfo = pSubtypeInfos[i];

      pNodeST = pNodeSubtypes.Nodes.Add("Subtype" + i.ToString());

      pNodeST.Nodes.Add("Subtype Code: '" + pSTInfo.SubtypeCode + "'");

      pNodeST.Nodes.Add("Subtype Name: '" + pSTInfo.SubtypeName + "'");

      pNodeFieldDomains = pNodeST.Nodes.Add("FieldDomainInfos >>");

      pFieldDomainInfos = pSTInfo.FieldDomainInfos;

      for (int j = 0; j < pFieldDomainInfos.Length; j++)

      {

      pFDInfo = pFieldDomainInfos[j];

            pNodeFD = pNodeFieldDomains.Nodes.Add("FieldDomain" + j.ToString());

            pNodeFD.Nodes.Add("Field Name: '" + pFDInfo.FieldName + "'");

            pNodeFD.Nodes.Add("Default Value: '" + ((pFDInfo.DefaultValue != null) ? pFDInfo.DefaultValue.ToString() : "<null>") + "'");

            pNodeDomain = pNodeFD.Nodes.Add("Domains >>");

            if (pFDInfo.Domain is MapServerWS.CodedValueDomain)

            {

            pCVDomain = (MapServerWS.CodedValueDomain)pFDInfo.Domain;

                  for (int k = 0; k < pCVDomain.CodedValues.Length; k++)

                  {

                  pCV = pCVDomain.CodedValues[k];

                        pNodeDomain.Nodes.Add("Code: " + pCV.Code + " (Description: " + pCV.Name + ")");

            }

}

else

            {

            pRDomain = (MapServerWS.RangeDomain)pFDInfo.Domain;

                  pNodeDomain.Nodes.Add("Min: '" + pRDomain.MinValue + "'");

                  pNodeDomain.Nodes.Add("Max: '" + pRDomain.MaxValue + "'");

}

}

}

pNodeRoot.ExpandAll();

11/8/2016