Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{anchor:top}
{toc: class=contents}

h2. Overview 概要
{styleclass: Class=topLink}[topページトップ|#top]
{styleclass}
Customカスタム関数は、XMLで書かれYellowfinサーバーに保持されている関数です。これらは、式ビルダーでは簡単に作成できない先進のSQL機能から構成されており、システム管理者によって設定されます。
functions are functions that are hand designed and that are stored in XML format on the Yellowfin server. These functions usually consist of advanced SQL functions that cannot be easily generated by the formula builder. These functions are configured by your system administrator.

The XML schema allows for the custom defined SQL functions to have parameters embedded so that numeric or column values can be assigned when the column is inserted into a report.

h3. Adding new Custom Functions
To add new XML functions into Yellowfin:
# Copy your XML into the custom-functions.xml file located in: {{Yellowfin
XMLスキーマを使用すると、カスタム定義のSQL関数でパラメーターを埋め込むことができるため、カラム(列)をレポートに挿入するときに数値やカラム(列)値を割り当てることができます。

h3. 新しいカスタム関数の追加

Yellowfinに新規XML関数を追加するには:
# XMLを次の場所にあるcustom-functions.xmlファイルにコピーします。Yellowfin/appserver/webapps/ROOT/WEB-INF/}}
# Onceこれらをディレクトリに追加したら、Yellowfinを再起動して、使用可能にします。
these
have
been added into the directory you will need to restart Yellowfin for these to become available. 

bq. SeeYellowfinでカスタム関数を使用する詳細については、 [式テンプレート(カスタム関数)] for more informationを参照してください。
on
using Custom Functions within Yellowfin.


h2. Schemaスキーマ
{styleclass: Class=topLink}[topページトップ|#top]
{styleclass}

||Parent 親オブジェクト Object||Object オブジェクト ||Description 説明 ||
| | {{<custom-function>}} |Most senior hierarchical object, encapsulates entire document. Only has one child type, {{<function>}}.|
|階層で最上位のオブジェクトであり、ドキュメント全体をカプセル化します。子タイプは<function>の1つのみです。 |
| {{<custom-function>}} | {{<function>}} |This defines独自の関数を定義し、その関数の定義に必要なデータフィールドをカプセル化します。子オブジェクトは<name>、<argument>、<sql>、<return>、および<aggregate>です。 a|
unique function, and encapsulates the data fields needed to define it. Child objects include {{<name>}}, {{<argument>}}, {{<sql>}}, {{<return>}} and {{<aggregate>}}.|
|| {{<function>}} | {{<name>}} | nameは、アプリケーション内でのカスタム関数の表示名を定義します。各カスタム関数のプライマリ識別子なので、それぞれにユニークな名前を付ける必要があります。各関数には名前を1つのみ設定できます。 |
| {{<function>}} | {{<name><argument>}} |Name defines the display name of the custom function within the application. It is the primary identifier for each of the custom function, therefore the names of each function must be unique. Each function can only have one name only.|
|{{<function>}}|argumentは、レポートの設計時にカスタムSQLに挿入できる引数(またはパラメーター)を定義します。引数は3つの属性<index>、<name>、および<datatype>で定義されます。 |
| {{<argument>}}|Argument defines an argument (or parameter) that can be inserted into the custom SQL at report design time. Arguments are defined by 3 attributes, | {{<index>}}, {{<name>}} and {{<datatype>}}.| argumentのindexパラメーターは、関数のコンテキストでその引数を一意に特定します。正の整数にする必要があります。indexは、引数をカスタムSQLステートメント内の定義された場所に挿入するために使用されます。indexが「1」の場合、SQLステートメントでは「$1」の出現箇所すべてが引数に置換されます。 |
| {{<argument>}}|{{<index>}}|The index parameter of argument uniquely identifies the argument in the context of the function and must be an integral positive value. The index is used for inserting the argument at the defined location within the custom SQL statement. If the index is "1" then the argument will be replaced in the SQL statement for every instance of "$1".| |{{<argument>}}|{{<name>}} |The name parameter of argument is the display name for the argument in the application.|
|argumentのnameパラメーターは、アプリケーションにおける引数の表示名です。 |
| {{<argument>}} | {{<datatype>}} |The datatype parameter of argument defines the datatype of the argument. This allows the application to only allow compatible columns and values to be entered into this argument. Datatype must be one of "numeric", "text" or "datetime".|
|argumentのdatatypeパラメーターは、引数のデータ型を定義します。このパラメーターを指定すると、この引数には互換性のあるカラムと値しか入力できません。データ型は、「numeric」、「text」、「datatime」のいずれか1つです。 |
| {{<function>}} | {{<sql>}} |SQL defines the actual database SQL statement to be made for this custom function. The SQL in this field will be inserted into a parent SQL statement as a single column, so a full SELECT FROM WHERE is not required and therefore the SQL must be compatible with single column syntax. See the example below for a simple CASE  sqlでは、このカスタム関数で作成される実際のデータベースSQLステートメントを定義します。このフィールドのSQLは、単一カラムとして親SQLステートメントに挿入されるので、完全なSELECT FROM WHEREは不要です。したがって、SQLは単一カラム構文との互換性が必要です。下に単一カラムのカスタム関数として単純なCASE WHEN ELSE ENDENDの例を示します。引数を挿入する必要がある場合は、このSQLに変数を含めることもできます。「$1」は、indexが1の引数に割り当てられたカラム(列)またはデータの値に置換されます。 example of a single column custom function. This SQL can also contain variables where arguments should be inserted. "$1" will be replaced with the column or data value assigned to the argument with index 1.|
||
| {{<function>}} | {{<aggregate>}} |The aggregateaggregateパラメーターは、カスタム関数内で集計されるカラム(列)を定義します。アプリケーションに対して、レポートSQLの生成時にこれらのカラムをGROUP parameterBY節に置かないように指示します。aggregateパラメーターの値も引数変数になります。たとえばindexが1の引数の場合は「$1」です。 defines which columns are aggregated within the custom function. This tells the application to not place these columns in the GROUP BY clause when generating the report SQL. The value of the aggregate parameter can also be a argument variable, for instance "$1" for the argument with index 1.|
||
| {{<function>}} | {{<groupby>}} |The groupgroupbyパラメーターは、アプリケーションがレポートSQLを生成するときにGROUP byBY句に挿入されるカラム(列)を定義します。groupbyパラメーターの値も引数変数になります。たとえばindexが1の引数の場合は「$1」です。 parameter defines which columns should be inserted into the GROUP BY clause when the application is generating the report SQL. The value of the group by parameter can also be a argument variable, for instance "$1" for the argument with index 1.|
||
| {{<function>}} | {{<database>}} |This specifies which database this function should be available for. If none are specified it will be shown for all. There should be one object per database. Examples are: SQLServer, PostgreSQL, OpenEdge, Progress, Oracle, DB2, Access, Notes, ODBC, HSQL, or MySQL.|
|この関数が使用可能なデータベースを指定します。何も指定されていない場合は、すべてのデータベースで表示されます。データベースごとに1つのオブジェクトがあるようにしてください。たとえばSQLServer、PostgreSQL、OpenEdge、Progress、Oracle、DB2、Access、Notes、ODBC、HSQL、またはMySQLです。 |
| {{<function>}} | {{<return>}} |The return function defines the data type of the information that is returned by the entire custom function. This must be one of "numeric", "text" or "datetime". return関数は、カスタム関数全体で返す情報のデータ型を定義します。「numeric」、「text」、「datatime」のいずれか1つです。 |


h2. Example CASE StatementCaseステートメントの例
{code:language=html/xml|title=custom-functions.xml|linenumbers=true}
<?xml version="1.0" encoding="ISO-8859-1"?>
<custom-functions>

<!-- functions are stored by name, so names must be unique, even across different databases -->


   <!-- ratio function -->
  <function>
    <name>Ratio</name>
    <argument>
      <index>1</index>
      <name>Numerator</name>
      <datatype>numeric</datatype> <!-- numeric, text, datetime -->
    </argument>
    <argument>
      <index>2</index>
      <name>Denominator</name>
      <datatype>numeric</datatype> <!-- numeric, text, datetime -->
    </argument>
    <sql>
      <![CDATA[
        CASE
          WHEN SUM($2) != 0 THEN SUM($1) / SUM($2)
          ELSE NULL
          END
      ]]>
    </sql>
    <aggregate>$1</aggregate>
    <aggregate>$2</aggregate>
    <database>SQLServer</database> <!-- Available for what DBs? SQLServer, PostgreSQL, OpenEdge, Progress, Oracle, DB2, Access, Notes, ODBC, HSQL, MySQL -->
    <database>HSQL</database>
    <return>numeric</return> <!-- numeric, text, datetime -->
  </function>

</custom-functions>
{code}

\\
\\
{horizontalrule}
{styleclass: Class=topLink}[topページトップ|#top]
{styleclass}