TAILIEUCHUNG - Crystal Reports 9 The Complete Reference PHẦN 3

Tham khảo tài liệu 'crystal reports 9 the complete reference phần 3', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 5 Using Formulas 149 Using the Join and Split Functions to Avoid Loops While the previous code is a great For loop example there s actually another built-in formula function that negates the need for the variable declarations the looping logic and the removal of the training comma space when creating a single string containing multivalue parameter field entries. Look at the following code J Regions chosen Join Region This formula uses the Join function similar to its Visual Basic counterpart which takes all the elements of the array supplied in the first parameter a multivalue parameter field actually is an array concatenates them together and optionally separates each with the string supplied in the second parameter. Join performs the same thing as all the looping logic and variable manipulation demonstrated earlier with one simple function. Conversely you may wish to take a string value or variable that contains multiple strings separated by a common delimiter such as a slash and create an array of string values. You could create a loop that cycles through the string one character at a time looking for the delimiter the slash and performing complex logic to extract the substring and add it to an array. But the Split function like its equivalent in Visual Basic will perform all this logic for you automatically. Look at the following code fragment this is not a complete formula IStringVar array Regions Regions Split Northwest Southwest Northeast Southeast Midwest The second line of code will populate the Regions array variable with five elements by looking through the string and separating the five substrings that are separated by slashes. But don t forget your looping capabilities just yet the Join and Split function work only with string values. If you have a muItivahie parameter field that is designated as a number date or other nonstring type you ll still need to use loops to extract the individual elements. And if you want to build a nonstring array .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.