PC SOFT

WINDEV的在线文档

  • Syntax 1: Browsing the array elements
  • Syntax 2: Browsing the values of the "Key" elements found in the array
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系:info@cn.windev.com
产品
WinDevWebDev-服务器代码WebDev-浏览器代码WinDev Mobile报表和查询
平台
WindowsLinuxWindows MobileWindows PhoneWindows Store appsAndroidAndroid Widget iPhone/iPad
语言
JavaPHPAjax用户代码(MCU)外部语言
数据库
HFSQLHFSQL Client/Server存储过程HF 5.5OLE DBODBC本地访问

对于每个 is used to perform different types of browse operations on the associative arrays:
  • Browsing the elements of the associative array.
  • Browsing the values of the elements found in the associative array.
Note: The FOR ALL, FOR EACH statements are accepted. In this documentation, we will be using the 对于每个 statement but it can be replaced by FOR ALL.

15版本和更高版本
The FOR EACH statement can also be used to browse the .Net objects that implement the IEnumerable interface.
15新版本
The FOR EACH statement can also be used to browse the .Net objects that implement the IEnumerable interface.
The FOR EACH statement can also be used to browse the .Net objects that implement the IEnumerable interface.

18版本和更高版本
WinDevWindows Store apps This feature is available in Windows Store apps mode.
18新版本
WinDevWindows Store apps This feature is available in Windows Store apps mode.
WinDevWindows Store apps This feature is available in Windows Store apps mode.
例子
// Declare an associative array of integers
// Array indexed on strings and without duplicates
aaIDPerCustomer整数型的关联数组型
aaIDPerCustomer"A"】=55
aaIDPerCustomer"B"】=321
aaIDPerCustomer"A"】=56
// Browse all the identifiers (syntax 1)
// 56
// 321
对于aaIDPerCustomer中的每个元素nIdentifier
跟踪nIdentifier
结束

// Declare an associative array of integers
// This array is indexed on strings with duplicates
// Ignores the case and the accented characters
aaIDPerCustomer数组型ASSOCIATIF允许重复+ccIgnoreCasse+字符串.忽略重音符号integers
aaIDPerCustomer"E"】=55
aaIDPerCustomer"B"】=321
aaIDPerCustomer"e"】=8
aaIDPerCustomer"é"】=127
// Browse all the identifiers of customers "E" (Syntax 2)
// 55
// 8
// 127
对于aaIDPerCustomer等于"E"中的每个元素nIdentifier
跟踪nIdentifier
结束

语法

Browsing the array elements 隐藏详细信息

 对于 EACH [ELEMENT] <Variable> [, <Key> [, <Counter>]] OF <Array> [WHERE <Condition>] [<Direction>]
    ...
END

<FOR EACH [ELEMENT]>:
Marks the beginning of the statement block. The ELEMENT keyword is optional.
<Variable>:
Variable whose type is identical to the type of the array elements. For the arrays of classes, the variable must be a Dynamic Class variable. There is no need to declare this variable.

Note: This variable is a reference to the array value. A modification of this variable in FOR EACH will also modify the value in the associative array.

<Key>:
Key of the element browsed. There is no need to declare this variable.
<Counter>:
Integer variable containing the number of iterations. There is no need to declare this variable.
<Array>:
Array to browse.
<Condition>:
20版本和更高版本
WinDev Condition to indicate to filter the browse. Only the array elements corresponding to the filter will be browsed.
20新版本
WinDev Condition to indicate to filter the browse. Only the array elements corresponding to the filter will be browsed.
WinDev Condition to indicate to filter the browse. Only the array elements corresponding to the filter will be browsed.
<Direction>:
Optional indicator for the browse direction.

从头部
(default value)
Browse the array in the order of additions into the array.
从尾部Browse the array in the reverse order of additions into the array.

Browsing the values of the "Key" elements found in the array 隐藏详细信息

 对于 EACH [ELEMENT] <Variable> OF <Array> = <Key> [WHERE <Condition>] [<Direction>]
    ...
END

<FOR EACH ELEMENT>:
Marks the beginning of the statement block. The ELEMENT keyword is optional.
<Variable>:
Variable whose type is identical to the type of the array elements. For the arrays of classes, the variable must be a Dynamic Class variable. There is no need to declare this variable.

Note: This variable is a reference to the array value. A modification of this variable in FOR EACH will also modify the value in the associative array.

<Array>:
Array to browse.
<Key>:
Value of the key for which the array elements must be browsed. For an associative array without duplicates, 0 or 1 element will be browsed. For an associative array with duplicates, 0 or N elements will be browsed.
<Condition>:
20版本和更高版本
WinDev Condition to indicate to filter the browse. Only the array elements corresponding to the filter will be browsed.
20新版本
WinDev Condition to indicate to filter the browse. Only the array elements corresponding to the filter will be browsed.
WinDev Condition to indicate to filter the browse. Only the array elements corresponding to the filter will be browsed.
<Direction>:
Optional indicator for the browse direction.

从头部
(default value)
Browse the array in the order of additions into the array.
从尾部Browse the array in the reverse order of additions into the array.

注意

Syntax 1: Browsing the array elements

For each iteration, <Variable> directly refers to the current element in the array. If the value of <Variable> is modified, the current element in the array is modified.

When exiting from the loop (standard exit or via the BREAK statement), the value of the last element read is assigned to <Variable> but <Variable> does not directly refer to the array element anymore.

Example:

// Declare an associative array of integers
// Array indexed on strings and without duplicates
aaIDPerCustomer整数型的关联数组型
aaIDPerCustomer"A"】=55
aaIDPerCustomer"B"】=321
aaIDPerCustomer"A"】=56
// Browse all the identifiers
// 56
// 321
对于aaIDPerCustomer中的每个元素nIdentifier
跟踪nIdentifier
结束

Syntax 2: Browsing the values of the "Key" elements found in the array

This syntax browses all the array elements with the specified <Key> value. For each iteration, <Variable> directly refers to the current element in the array. If the value of <Variable> is modified, the current element in the array is modified.

This syntax is useful when browsing associative arrays with duplicates. In an associative array without duplicates, the number of elements browsed can be 0 or 1. In an associative array with duplicates, the number of elements browsed can be 0 or N.

The array elements are browsed in the order of additions (no direction option).

When exiting from the loop (standard exit or via the BREAK statement), the value of the last element read is assigned to <Variable> but <Variable> does not directly refer to the array element anymore.

Example:

// Declare an associative array of integers
// This array is indexed on strings with duplicates
// Ignores the case and the accented characters
aaIDPerCustomer数组型ASSOCIATIF允许重复+ccIgnoreCasse+字符串.忽略重音符号integers
aaIDPerCustomer"E"】=55
aaIDPerCustomer"B"】=321
aaIDPerCustomer"e"】=8
aaIDPerCustomer"é"】=127
// Browse all the identifiers of customers "E"
// 55
// 8
// 127
对于aaIDPerCustomer等于"E"中的每个元素nIdentifier
跟踪nIdentifier
结束