有条件地使用XML弹出消息

时间:2018-02-08 05:13:42

标签: xml xsd

我陷入一种情况,我必须检查一个条件,如果这是真的,那么当用户点击相关按钮时我需要弹出一条消息。

我将无法粘贴整个XML,因此会粘贴相关的XML文件。

XML -

<var name="arg_lock_visible">
    <select><![CDATA[select case when has_action_access('Lock') = 'Y' then 1 else 0 end from dual]]></select>
</var>
    <arg name="arg_nb_entities" from="data_space" value="ds_selected_entities" />

<actions_template name="check_action_promote_demote">
            <set_data_space name="ds_selected_entities" value="0" />

            <for_each ref="dw_promote" from="all">
                <if>
                    <condition>
                        <expression>
                            if(:arg_promote=:var_action_promote, if(:promote_check='Y',1,0),
                            if(:arg_promote=:var_action_lock, if(:lock_check='Y',1,0),
                            if(:arg_promote=:var_action_demote, if(:demote_check='Y',1,0),
                            if(:arg_promote=:var_action_unlock, if(:unlock_check='Y',1,0),0))))
                        </expression>
                    </condition>
                    <then>
                        <set_data_space name="ds_selected_entities">
                            <expression>:ds_selected_entities + 1</expression>
                        </set_data_space>
                    </then>
                </if>
            </for_each>
            <if>
                <condition>
                    <expression>
                        if (:ds_selected_entities=0, 1, 0)
                    </expression>
                </condition>
                <then>
                    <information_message>:arg_msg_no_action</information_message>
                </then>
            </if>
        </actions_template>

<button label="Lock" icon="lock.png" label_visible="true" button_style="true">
                                    <visible>
                                        <expression>:arg_lock_visible</expression>
                                    </visible>
                                    <set_local_value name="arg_promote" ref="var_action_lock" />
                                    <set_local_value name="arg_msg" value="Please add a comment to explain the lock." />
                                    <set_local_value name="arg_msg_no_action" value="You must select at least one entity to lock." />
                                    <run_actions_template template="check_action_promote_demote" />
                                    <set_local_value name="arg_title">
                                                               <expression>'Lock (' + string(:arg_nb_entities) + if         (:arg_nb_entities = 1, ' entity)', ' entities)')</expression>
                                        <arg name="arg_nb_entities" from="data_space" value="ds_selected_entities"></arg>
                                    </set_local_value>

                                    <run_actions_template template="action_promote_demote" />
                                </button>       

在这个XML中,我需要在模板中添加相同的条件&#34; check_action_promote_demote&#34;如

<if>
            <condition>
                <expression>
                    if (:ds_selected_entities=0, 1, 0)
                </expression>
            </condition>
            <then>
                <information_message>:arg_msg_no_action</information_message>
            </then>
        </if>

上面的代码负责显示消息

<set_local_value name="arg_msg_no_action" value="You must select at least one entity to lock." />

同样地,我需要在这里添加一个条件或者在模板中说IF ELSE块,我有一个基于传递给它的参数返回0或1的SQL,所以当SQL的输出是#34时; N&#34;那么它应该显示另一条消息&#34;请选择有效的实体&#34;。

我已将XML更改为以下但不起作用:(

    <var name="arg_lock_visible">
    <select><![CDATA[select case when has_action_access('Lock') = 'Y' then 1 else 0 end from dual]]></select>
</var>
    <var name="arg_promote_visible">
            <select><![CDATA[select 0 from dual]]></select>
        </var>
    <arg name="arg_nb_entities" from="data_space" value="ds_selected_entities" />

    <actions_template name="check_action_promote_demote">
                <set_data_space name="ds_selected_entities" value="0" />

                <for_each ref="dw_promote" from="all">
                    <if>
                        <condition>
                            <expression>
                                if(:arg_promote=:var_action_promote, if(:promote_check='Y',1,0),
                                if(:arg_promote=:var_action_lock, if(:lock_check='Y',1,0),
                                if(:arg_promote=:var_action_demote, if(:demote_check='Y',1,0),
                                if(:arg_promote=:var_action_unlock, if(:unlock_check='Y',1,0),0))))
                            </expression>
                        </condition>
                        <then>
                            <set_data_space name="ds_selected_entities">
                                <expression>:ds_selected_entities + 1</expression>
                            </set_data_space>
                        </then>
                    </if>
                </for_each>
                <if>
                    <condition>
                        <expression>
                            if (:ds_selected_entities=0, 1, 0)
                        </expression>
                    </condition>
                    <then>
                        <information_message>:arg_msg_no_action</information_message>
                    </then>
                </if>
                <if>
                    <condition>
                        <expression>
                            if (:ds_selected_entities=0, 1, 0)
                        </expression>
                    </condition>
                    <then>
                        <information_message>:arg_msg_no_action</information_message>
                    </then>
                </if>
                <if>
                    <condition>
                        <expression>
                            if (:test_arg=0, 1, 0)
                        </expression>
                    </condition>
                    <then>
                        <information_message>:arg_msg_no_lock</information_message>
                    </then>
                </if>
            </actions_template>

    <button label="Lock" icon="lock.png" label_visible="true" button_style="true">
                                        <visible>
                                            <expression>:arg_lock_visible</expression>
                                        </visible>
                                        <set_local_value name="arg_promote" ref="var_action_lock" />
                                        <set_local_value name="arg_msg" value="Please add a comment to explain the lock." />
                                        <set_local_value name="arg_msg_no_action" value="You must select at least one entity to lock." />
                                        <set_local_value name="arg_msg_no_lock" value="All entities are not at level 3." />
                                        <run_actions_template template="check_action_promote_demote" />
                                        <set_local_value name="arg_title">
                                            <expression>'Lock (' + string(:arg_nb_entities) + if(:arg_nb_entities = 1, ' entity)', ' entities)')</expression>
                                            <arg name="arg_nb_entities" from="data_space" value="ds_selected_entities"></arg>
                                        </set_local_value>

                                        <run_actions_template template="action_promote_demote" />
                                    </button>

我对XML并不熟悉,因此无法确定应该在哪里进行更改以满足要求。 如果需要,请询问更多信息。

任何帮助都会很明显!

0 个答案:

没有答案