Setting Up Conditional Formatting

Below is the example of using the SetEaxMd operation to set up conditional formatting in express report table. The request contains moniker of opened express report instance, the pattern indicating whether styles of conditional formats must be changed, and metadata that contains two conditional formats. The first conditional format highlights maximum values, the second one highlights minimum ones. Each conditional format has its own formatting style. The operation results in the moniker of the changed express report.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SetEaxMd xmlns="http://www.fsight.ru/PP.SOM.Som">
<tEax xmlns=" ">
  <id>S1!M!S!E1</id>
  </tEax>
<tArg xmlns=" ">
<pattern>
  <obInst>false</obInst>
<gridStyle>
<ops>
<it>
  <Key>InternalFormatConditions</Key>
  <Value>Set</Value>
  </it>
  </ops>
  </gridStyle>
  </pattern>
<meta>
<grid>
<style>
<internalFormatConditions>
<Condition>
  <Key>0</Key>
  <Type>RankValues</Type>
  <Enabled>true</Enabled>
<Details>
<RankValues>
  <Type>0</Type>
  <Percent>0</Percent>
  <Count>3</Count>
<Style>
  <Font F="Calibri" C="#00FF00" B="true" />
  </Style>
  <PercentUsed>false</PercentUsed>
  </RankValues>
  </Details>
  </Condition>
<Condition>
  <Key>0</Key>
  <Type>RankValues</Type>
  <Enabled>true</Enabled>
<Details>
<RankValues>
  <Type>1</Type>
  <Percent>0</Percent>
  <Count>3</Count>
<Style>
  <Font F="Calibri" C="#FF0000" I="true" />
  </Style>
  <PercentUsed>false</PercentUsed>
  </RankValues>
  </Details>
  </Condition>
  </internalFormatConditions>
  </style>
  </grid>
  </meta>
  </tArg>
  </SetEaxMd>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetEaxMdResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <changedDims xmlns=" " />
<id xmlns=" ">
  <id>S1!M!S!E1</id>
  </id>
  </SetEaxMdResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
 "SetEaxMd" : 
  {
   "tEax" : 
    {
     "id" : "S1!M!S!E2"
    },
   "tArg" : 
    {
     "pattern" : 
      {
       "obInst" : "false",
       "gridStyle" : 
        {
         "ops" : 
          {
           "it" : 
            {
             "Key" : "InternalFormatConditions",
             "Value" : "Set"
            }
          }
        }
      },
     "meta" : 
      {
       "grid" : 
        {
         "style" : 
          {
           "internalFormatConditions" : 
            {
             "Condition" : 
              [
                {
                 "Key" : "0",
                 "Type" : "RankValues",
                 "Enabled" : "true",
                 "Details" : 
                  {
                   "RankValues" : 
                    {
                     "Type" : "0",
                     "Percent" : "0",
                     "Count" : "3",
                     "Style" : 
                      {
                       "Font" : 
                        {
                         "@B" : "true",
                         "@C" : "#00FF00",
                         "@F" : "Calibri"
                        }
                      },
                     "PercentUsed" : "false"
                    }
                  }
                },
                {
                 "Key" : "0",
                 "Type" : "RankValues",
                 "Enabled" : "true",
                 "Details" : 
                  {
                   "RankValues" : 
                    {
                     "Type" : "1",
                     "Percent" : "0",
                     "Count" : "3",
                     "Style" : 
                      {
                       "Font" : 
                        {
                         "@C" : "#FF0000",
                         "@F" : "Calibri",
                         "@I" : "true"
                        }
                      },
                     "PercentUsed" : "false"
                    }
                  }
                }
              ]
            }
          }
        }
      }
    }
  }
}

JSON response:

{
 "SetEaxMdResult" : 
  {
   "changedDims" : "",
   "id" : 
    {
     "id" : "S1!M!S!E2"
    }
  }
}
    public static SetEaxMdResult SetEaxFormatConditions(EaxId moniker)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tEaxMd = new SetEaxMd()
{
tArg = new SetEaxMdArg()
{
pattern = new EaxMdPattern() //Pattern that will be used to change metadata
{
obInst = false,
gridStyle = new EaxGridStylePattern() //Set up conditional formats
{
ops = new EaxGridStylePartListOpsIT[]
{
new EaxGridStylePartListOpsIT() { Key = EaxGridStylePart.InternalFormatConditions, Value = ListOperation.Set },
}
}
},
//Changed metadata
meta = new EaxMd()
{
grid = new EaxGrid() //Set up totals formatting
{
style = new EaxGridStyle()
{
internalFormatConditions = new TabFormatCondition[]
{
new TabFormatCondition() //Format of maximum value highlighting
{
Type = TabConditionType.RankValues,
Enabled = true,
Details = new TabFormatConditionDetails()
{
RankValues = new TabFormatRankValues()
{
Count = 1,
Type = 0, //Maximum values
Style = new TabStyle()
{
Font = new TabFontStyle()
{
B = true,
BSpecified = true,
C = "#00FF00",
F = "Calibri",
}
}
}
}
},
new TabFormatCondition() //Format of minimum value highlighting
{
Type = TabConditionType.RankValues,
Enabled = true,
Details = new TabFormatConditionDetails()
{
RankValues = new TabFormatRankValues()
{
Count = 1,
Type = 1, //Minimum values
Style = new TabStyle()
{
Font = new TabFontStyle()
{
I = true,
ISpecified = true,
C = "#FF0000",
F = "Calibri",
}
}
}
}
}
}
}
}
}
},
tEax = moniker
};
//Change totals parameters
var result = somClient.SetEaxMd(tEaxMd);
return result;
}

See also:

SetEaxMd: Operation