在逗号分隔的项目列表上运行循环4GL

时间:2012-04-03 13:35:10

标签: progress-4gl openedge

def var cList as char no-undo.
assign cList = "one,two,three,four".
<Loop> cList
logic...
</Loop>

在char变量中循环逗号分隔列表的最佳方法是什么,这样在本例中我会得到一个然后是两个然后是三个呢。

3 个答案:

答案 0 :(得分:3)

DEFINE VARIABLE ch-list     AS CHARACTER    NO-UNDO.
DEFINE VARIABLE i-cnt       AS INTEGER      NO-UNDO.
DEFINE VARIABLE i-entry     AS INTEGER      NO-UNDO.

ASSIGN
    ch-list = "one,two,three,four"
    .

ASSIGN
    i-cnt = NUM-ENTRIES(ch-list)
    .

REPEAT i-entry = 1 TO i-cnt:

    DISPLAY
        ENTRY(i-entry, ch-list)
        WITH DOWN.

END.

答案 1 :(得分:3)

大声笑我还记得我想过的一点进步。

DEF VAR i AS INT NO-UNDO.
&SCOPED-DEFINE LIST "one,two,three,four"

DO i=1 TO NUM-ENTRIES({&LIST}):
  MESSAGE SUBSTITUTE("LIST[&1] is &2", i, ENTRY(i, {&LIST})).
END.

答案 2 :(得分:-1)

<record model="ir.ui.view" id="opc_tagwaarden_tree_id">
    <field name="name">opc_actuelewaardentags_tree</field>
    <field name="model">opc_tags</field>
    <field name="arch" type="xml">
        <tree delete="false">
            <field name="tagnaam" readonly="True"/>
            <field name="tagwaarde"/>
            <field name="tagkwaliteit" readonly="True"/>
            <field name="melding" readonly="True"/>
            <field name="schrijvennaaropc"/>
            <field name="unit" readonly="True"/>
        </tree>
    </field>
</record>

<record model="ir.ui.view" id="opc_tagwaarden_form_id">
    <field name="name">opc_actuelewaardentags_form</field>
    <field name="model">opc_tags</field>
    <field name="type">form</field>
    <field name="arch" type="xml">
        <form string="OPC Actuele waarden tags">
            <group colspan="1" col="4">
            <field name="tagnaam" readonly="True"/>
            <field name="tagwaarde"/>
            <field name="tagkwaliteit" readonly="True"/>
            <field name="melding" readonly="True"/>
            <field name="schrijvennaaropc"/>
            <field name="unit" readonly="True"/>
            </group>
        </form>
    </field>        
</record>

<record id="action_tagwaarden" model="ir.actions.act_window">
    <field name="name">OPC Actuele waarden tags</field>
    <field name="res_model">opc_tags</field>
    <field name="type">ir.actions.act_window</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form</field>
</record>

<record id="action_tagwaarden_tree" model="ir.actions.act_window.view">
    <field name="view_mode">tree</field>
    <field name="view_id" ref="opc_tagwaarden_tree_id" />
    <field name="act_window_id" ref="action_tagwaarden" />
</record>

<record id="action_tagwaarden_form" model="ir.actions.act_window.view">
    <field name="view_mode">form</field>
    <field name="view_id" ref="opc_tagwaarden_form_id" />
    <field name="act_window_id" ref="action_tagwaarden" />
</record>

<menuitem action="action_tagwaarden" id="menu_tagwaarden_id" sequence="2" name="OPC Actuele waarden" parent="Submenu"/>