MyPage is a personalized page based on your interests.The page is customized to help you to find content that matters you the most.


I'm not curious

esProc's Option Syntax

Published on 16 September 14
0
0

1. esProc’s function options

Many functions in esProc can use function options with which the same function can have different work patterns. The basic format of function options is f@o(…) in which o is f function’s option. For example:
esProc's Option Syntax - Image 1
We can use interval function to compute the days between two dates. In expressions in A3 and A4, @y and @m are interval function’s options. With these options, the function will use the year and the month as computational units in computing time interval. With function options, a function can meet multiple needs, extend its functions and avoid too many function names or function parameters.

2. Common function options
Some function options are common in esProc. They can be used by many functions.
  • @1 and @a
@1 option and @a option are frequently used by functions to position, select and join, such as, A.pos(), A.select(), A.pmax(), A.pselect(), A.minp(), P.align(), etc.

Use of @a option can make functions that return the first query result by default return all eligible results. Contrary to @a, functions that return multiple members by default will return only the first query result by using @1 option.
We’ll look at the use of these two options through some examples:
esProc's Option Syntax - Image 2
esProc's Option Syntax - Image 3
By the way, since digit 1 is difficult to distinguish from the lowercase letter l, in most cases, the former is used in esProc’s options.

One other thing need to be made known is that the same option in different functions can have different meanings. For example, @a used in position functions means returning all results, while in functions for file writing, like f.write() and f.export(), it means appending.

  • @z
@z option is often used in some functions relating to order, like sort, position, select, etc. Such as A.rank(), A.sort(), A.pos(), A.pselect(), A.select() and so on.
esProc's Option Syntax - Image 4
With @z option, position or select in a sequence or a table sequence will be executed from back to front. Thus in this example, A2 returns the position of the last 2 and A3 returns results of sorting in descending order. Records obtained by A5 are also sorted in descending order.
  • @b
@b option is often used in functions to position, select, etc., like A.pos(), A.pselect(), A.select(), and so on. The use of @b option is usually accompanied by binary search algorithm, which is more efficient, in query, with the prerequisite that A is ordered; otherwise results may be wrong.
esProc's Option Syntax - Image 5
Since data in A1 are not sorted according to state ID, only one result is obtained with the binary search method when @b option is used in A2; while A4 obtains the correct results because data are sorted in A3.

But it is another thing when @b is used in functions to read and write, such as f.import(), f.export(), f.cursor(). In this case, it is the binary files that being read in or written out. In esProc, binary files have smaller storage size and faster access speed, therefore the use of binary files will bring higher efficiency.

3. Simultaneous use of multiple options
Multiple options can be used simultaneously in esProc when needed. There is no particular order among these options. For example:
esProc's Option Syntax - Image 6
Because both A 2 and A3 get positions of all the 2 in A1 from back to front, their results are identical. A5 gets the first city whose state ID is 5 from back to front.
Note that some function options are contradictory to each other, and cannot appear simultaneously. Such as @a and @1, @t and @b options of f.import().
This blog is listed under Development & Implementations Community

Related Posts:

Java

 
Post a Comment

Please notify me the replies via email.

Important:
  • We hope the conversations that take place on MyTechLogy.com will be constructive and thought-provoking.
  • To ensure the quality of the discussion, our moderators may review/edit the comments for clarity and relevance.
  • Comments that are promotional, mean-spirited, or off-topic may be deleted per the moderators' judgment.
You may also be interested in
 
Awards & Accolades for MyTechLogy
Winner of
REDHERRING
Top 100 Asia
Finalist at SiTF Awards 2014 under the category Best Social & Community Product
Finalist at HR Vendor of the Year 2015 Awards under the category Best Learning Management System
Finalist at HR Vendor of the Year 2015 Awards under the category Best Talent Management Software
Hidden Image Url

Back to Top