# EssOtlSetAttributeSpecifications

Description

EssOtlSetAttributeSpecifications() sets attribute specifications for the outline.

Syntax

ESS_FUNC_M EssOtlSetAttributeSpecifications (hOutline, pAttrSpecs);

ESS_HOUTLINE_T | hOutline;
ESS_PPATTRSPECS_T | pAttrSpecs;

Parameters

hOutline | Handle to the outline
pAttrSpecs | Attribute specifications

Return Value

If renaming attribute members fails, OTLAPI_ERR_ATTRRENAMENAMEUSED error is returned.

Notes

- Attribute specifications are used to do the following:
  - Generate a long name
  - Indicate the format of a datetime attribute
  - Indicate a numeric attribute's bucketing type
  - Provide the name of the attribute calculations dimension and the names for the values used with it
- If you do not set attribute specifications, the outline uses the default attribute specifications.
- Changing attribute specifications may cause a restructure.

Access

Example

    void  ESS_OtlSetAttributeSpecifications()
    {
       ESS_STS_T        sts = ESS_STS_NOERR;
       ESS_ATTRSPECS_T  AttrSpecs;
       ESS_CHAR_T       buffer[8][20];
       ESS_OBJDEF_T     Object;
       ESS_HOUTLINE_T   hOutline;
       ESS_APPNAME_T    szAppName;
       ESS_DBNAME_T     szDbName;
       ESS_OBJNAME_T    szFileName;
       ESS_PROCSTATE_T  pState;
       int              test;

       memset(&Object, '\0', sizeof(Object));
        Object.hCtx = hCtx;
        Object.ObjType = ESS_OBJTYPE_OUTLINE;
        strcpy(szAppName, "Sample");
        strcpy(szDbName, "Basic");
        strcpy(szFileName, "Basic");
        Object.AppName = szAppName;
        Object.DbName = szDbName;
        Object.FileName = szFileName;

        sts = EssOtlOpenOutline(hCtx, &Object, ESS_TRUE, ESS_TRUE, &hOutline);

       printf("\n\nEnter the NUMBERS for the appropriate choices that follow.");
       printf("\n\nEnter GenNameBy:\n\t\t0. ESS_GENNAMEBY_PREFIX\n\t\t1. ESS_GENNAMEBY_SUFFIX\n\nChoice: ");
       test = atoi(gets(buffer[0]));
       switch (test)
        {
          case 0:
             AttrSpecs.usGenNameBy=ESS_GENNAMEBY_PREFIX;
             break;
          case 1:
             AttrSpecs.usGenNameBy=ESS_GENNAMEBY_SUFFIX;
             break;
          default:
             printf("\n\nInvalid choice.\n\n");
        }

       printf("\n\nEnter UseNameOf:\n\t\t0.  ESS_USENAMEOF_NONE\n\t\t1.  ESS_USENAMEOF_PARENT");
       printf("\n\t\t2.  ESS_USENAMEOF_GRANDPARENTANDPARENT\n\t\t3.  ESS_USENAMEOF_ALLANCESTORS");
       printf("\n\t\t4.  ESS_USENAMEOF_DIMENSION\n\nChoice: ");
       test = atoi(gets(buffer[0]));
       switch (test)
        {
          case 0:
             AttrSpecs.usUseNameOf=ESS_USENAMEOF_NONE;
             break;
          case 1:
             AttrSpecs.usUseNameOf=ESS_USENAMEOF_PARENT;
             break;
          case 2:
             AttrSpecs.usUseNameOf=ESS_USENAMEOF_GRANDPARENTANDPARENT;
             break;
          case 3:
             AttrSpecs.usUseNameOf=ESS_USENAMEOF_ALLANCESTORS;
             break;
          case 4:
             AttrSpecs.usUseNameOf=ESS_USENAMEOF_DIMENSION;
             break;
          default:
             printf("\n\nInvalid choice.\n\n");
        }

        printf("Enter Delimiter:\n\t\t0.  ESS_DELIMITER_UNDERSCORE\n\t\t1.  ESS_DELIMITER_PIPE");
       printf("\n\t\t2.  ESS_DELIMITER_CARET\n\nChoice: ");
       test = atoi(gets(buffer[0]));
       switch (test)
        {
          case 0:
             AttrSpecs.cDelimiter=ESS_DELIMITER_UNDERSCORE;
             break;
          case 1:
             AttrSpecs.cDelimiter=ESS_DELIMITER_PIPE;
             break;
          case 2:
             AttrSpecs.cDelimiter=ESS_DELIMITER_CARET;
             break;
          default:
             printf("\n\nInvalid choice.\n\n");
        }

       printf("Enter DateFormat:\n\t\t0.  ESS_DATEFORMAT_MMDDYYYY\n\t\t1.  ESS_DATEFORMAT_DDMMYYYY\n\nChoice: ");
       test = atoi(gets(buffer[0]));
       switch (test)
        {
          case 0:
             AttrSpecs.usDateFormat=ESS_DATEFORMAT_MMDDYYYY;
             break;
          case 1:
             AttrSpecs.usDateFormat=ESS_DATEFORMAT_DDMMYYYY;
             break;
          default:
             printf("\n\nInvalid choice.\n\n");
        }

        printf("Enter BucketingType:\n\t\t0.  ESS_UPPERBOUNDINCLUSIVE\n\t\t1.  ESS_LOWERBOUNDINCLUSIVE");
       printf("\n\t\t2.  ESS_UPPERBOUNDNONINCLUSIVE\n\t\t3.  ESS_LOWERBOUNDNONINCLUSIVE\n\nChoice:  ");
       test = atoi(gets(buffer[0]));
       switch (test)
        {
          case 0:
             AttrSpecs.usBucketingType=ESS_UPPERBOUNDINCLUSIVE;
             break;
          case 1:
             AttrSpecs.usBucketingType=ESS_LOWERBOUNDINCLUSIVE;
             break;
          default:
             printf("\n\nInvalid choice.\n\n");
        }

       printf("\nEnter a word for your default true string (or 'ESS_DEFAULT_TRUESTRING'):\n");

       gets(buffer[0]);
       if (buffer[0] == "ESS_DEFAULT_TRUESTRING")
          AttrSpecs.pszDefaultTrueString = "";
       else
          AttrSpecs.pszDefaultTrueString=buffer[0];

        printf("\nEnter your default false string (or 'ESS_DEFAULT_FALSESTRING'):\n");
       gets(buffer[1]);
       if (buffer[1] == "ESS_DEFAULT_FALSESTRING")
          AttrSpecs.pszDefaultFalseString = "";
       else
          AttrSpecs.pszDefaultFalseString=buffer[1];

        printf("\nEnter your default attribute calculation dimension name (or 'ESS_DEFAULT_ATTRIBUTECALCULATIONS'):\n");
       gets(buffer[2]);
       if (buffer[2] == "ESS_DEFAULT_ATTRIBUTECALULATIONS")
          AttrSpecs.pszDefaultAttrCalcDimName="";
       else
          AttrSpecs.pszDefaultAttrCalcDimName=buffer[2];

        printf("\nEnter your default sum member name (or 'ESS_DEFAULT_SUM'):\n");
       gets(buffer[3]);
       if (buffer[3] == "ESS_DEFAULT_SUM")
          AttrSpecs.pszDefaultSumMbrName = "";
       else
          AttrSpecs.pszDefaultSumMbrName=buffer[3];

       printf("\nEnter your default count member name (or 'ESS_DEFAULT_COUNT'):\n");
       gets(buffer[4]);
       if (buffer[4] == "ESS_DEFAULT_COUNT")
          AttrSpecs.pszDefaultCountMbrName = "";
       else
          AttrSpecs.pszDefaultCountMbrName=buffer[4];

        printf("\nEnter your default average member name (or 'ESS_DEFAULT_AVERAGE'):\n");
       gets(buffer[5]);
       if (buffer[5] == "ESS_DEFAULT_AVERAGE")
          AttrSpecs.pszDefaultAverageMbrName = "";
       else
          AttrSpecs.pszDefaultAverageMbrName=buffer[5];

       printf("\nEnter your default minimum member name (or 'ESS_DEFAULT_MIN'):\n");
       gets(buffer[6]);
       if (buffer[6] == "ESS_DEFAULT_MIN")
          AttrSpecs.pszDefaultMinMbrName = "";
       else
          AttrSpecs.pszDefaultMinMbrName=buffer[6];

       printf("\nEnter your default maximum member name (or 'ESS_DEFAULT_MAX'):\n");
       gets(buffer[7]);
       if (buffer[7] == "ESS_DEFAULT_MAX")
          AttrSpecs.pszDefaultMaxMbrName = "";
       else
          AttrSpecs.pszDefaultMaxMbrName=buffer[7];

       sts = EssOtlSetAttributeSpecifications(hOutline, &AttrSpecs);
       printf("EssOtlSetAttributeSpecifications() sts: %ld\n",sts);

       sts = EssOtlWriteOutline(hOutline, &Object);
       printf("EssOtlWriteOutline() sts: %ld\n",sts);

       sts = EssOtlRestructure(hCtx, ESS_DOR_ALLDATA);
       printf("EssOtlRestructure() sts: %ld\n",sts);

       if (!sts)
       {
          sts = EssGetProcessState (hCtx, &pState);
          while (!sts || (pState.State != ESS_STATE_DONE))
             sts = EssGetProcessState (hCtx, &pState);
       }
       sts = EssOtlCloseOutline(hOutline);
       printf("EssOtlCloseOutline() sts: %ld\n",sts);
    }

See Also

EssCheckAttributes()
EssFreeStructure()
EssGetAssociatedAttributesInfo()
EssGetAttributeInfo()
EssGetAttributeSpecifications()
EssOtlAssociateAttributeDimension()
EssOtlAssociateAttributeMember()
EssOtlDisassociateAttributeDimension()
EssOtlDisassociateAttributeMember()
EssOtlFindAttributeMembers()
EssOtlFreeStructure()
EssOtlGetAssociatedAttributes()
EssOtlGetAttributeInfo()
EssOtlGetAttributeSpecifications()
EssOtlQueryAttributes()