首页 > 解决方案 > icCube Reporting - 使用事件的标签:格式和语法

问题描述

在标签框中使用事件变量的正确语法是什么(例如标题标题)。

有一个定义的事件(例如测试),有什么可能的用途?以下表达式的含义是什么?

@{Test:'替代文本'!} @{Test}

还有其他可用的功能吗?

标签: iccubeiccube-reporting

解决方案


icCube 中的事件是主要实现两种方法的对象(基类是 viz.event.Event):

  • caption() - 返回事件的标题/名称,例如意大利为国家 MDX 成员
  • asMdx() - 返回 mdx 唯一名称(如果没有,则为标题),例如 [Country].[Italy]

因此,当您定义事件侦听器@{eventName}时,它将被它的 caption() 值更改,除非您在 MDX 表达式中它被 asMdx() 值更改。

您可以通过三种方式装饰您的活动

@{eventName!emptyValue}         -> if the event is empty, returns  the string 'emptyValue' (without single quotes)
@{eventName:eventFunction}      -> calls eventObject.eventFunction , e.g. @{event:asMdx}
@{eventName:'valueIfNotEmpty'}  -> if the event exists, return the string 'valueIfNotEmpty' (without single quotes)

有关文档的更多信息。

由于它是 javascript,因此您可以自由地将自己的方法添加到类的对象中(例如,在小部件中使用On Send Event挂钩 - JS 图标)

所有事件实现的接口是:

   export interface IEvent {
        /**
         * Return true if the event is empty.
         * @returns {boolean}
         */
        isEmptyEvent():boolean;

        /**
         * Returns the caption of the event.
         * @returns {string}
         */
        caption():string;

        /**
         * Returns the value of the event.
         * @returns {string}
         */
        value():any;

        /**
         * Returns the event value as MDX expression.
         * @returns {string}
         */
        asMdx():string;

        /**
         * Return the event value key
         * @return {string}
         */
        asKey():string;

        /**
         * Return the string representation of member key with quotes. If multiple keys present it returns: 'key1', 'key2', 'key3'
         * @return {string}
         */
        asQuotedKey():string;

        /**
         * Return the string representation of member captions with quotes. If multiple keys present it returns: 'name1, 'name2', 'name3'
         * @return {string}
         */
        asQuotedCaption():string;

        /**
         * Return the array of event keys
         * @return {Array}
         */
        asKeyArray():string[];

        /**
         * Returns the event value es MDX set expression.
         * @returns {string}
         */
        asSet():string;

        /**
         * Returns the event value as filter initial selection.
         * @returns {any}
         */
        asFilterInitialSelection():any;

        /**
         * Return true if the event is selection event. Used for type check.
         * @returns {boolean}
         */
        isSelectionEvent():boolean;

        /**
         * Returns the event value as an array.
         * @returns {any[]}
         */
        getSelectedItems():any[];

        /**
         * Returns a serialized event object.
         * @returns {EventGuts}
         */
        asReportParam():EventGuts;
    }

推荐阅读