Skip to content

Name_items Command

Obsolete

This command is obsolete. This command is valid only in character-mode DataFlex. There is no Windows equivalent for this option.

See Also

Purpose

To associate names with items.

Syntax

name_items
[
    item
    {
        next
        | item_number
    }
] name [... name]

What It Does

Without the optional modifiers, this command assigns the first name to Item 0, the second to Item 1, and so on.

You can continue naming on a new command line from the preceding name_items command with the next modifier, as many times as you like.

name_items alpha## bravo## charlie##
name_items item next delta## echo## foxtrot##

You can name an item starting at a specific item with the item_number modifier. Remember that the item number is zero-based (the first item is Item 0).

name_items item 5 foxtrot## golf##

The following two lines are identical:

name_items Quantity## Amount## Price##
name_items item 0 Quantity## Amount## Price##

Of course, with this method, you have to make sure that your item names are ordered correctly, just as with the old name command. If you change your items around, you'll have to change your name_items command. entry_name_item is better at handling these kinds of changes.

The above program could be changed to:

name_items TrID## PartID## Desc## Amount## Quantity## Total##

or

name_items item 3 Amount## Quantity## Total##
Object My_Form is an entry_form My_Form ;
    Using whatever Updating whichever

    Procedure Calc_Total Integer Item#
        Number A1 A2
        Get value item Quantity## to A1
        Get value item Amount## to A2
        Set value item Total## to (A1 * A2)
    end_procedure

    item_list
        entry_item Tran.Id          {Autofind}
        entry_item Part.Id          {AutoFind, FindReq, iExit = MSG_Calc_Total}
        entry_item Part.Description  {DisplayOnly}
        entry_item Part.Amount       {DisplayOnly}
        entry_item Tran.Quantity     {iExit = MSG_Calc_Total}
        entry_item Tran.Total        {DisplayOnly}
    end_item_list
end_object

Don't use name_items where you could use entry_name_item or on_name_item. It is too easy to get the item names in the wrong order. If you really want to use this command, you can employ a double-check capability. You can use name_items and entry_name_item or on_name_item to name the same item. As long as the item numbers and names agree, all will be well. If they do not agree, you will get a compiler error (which is exactly what you want).

This would work:

name_items TrID## PartID## Desc## Amount## Quantity## Total##
item_list
    entry_item Tran.Id
    entry_item Part.Id
    entry_item Part.Description
    entry_name_item Amount## Part.Amount
    entry_name_item Quantity## Tran.Qty
    entry_name_item Total## Tran.Total
end_item_list

This would generate a compiler error:

name_items TrID## PartID## Desc## Amount## Quantity## Total##
item_list
    entry_item Tran.Id
    entry_item Part.Id
    entry_name_item Amount## Part.Amount
    entry_name_item Quantity## Tran.Qty
    entry_name_item Total## Tran.Total
    entry_item Part.Description
end_item_list