Commands - Phoebus Url

Giới thiệu


Mọi lệnh của Phoebus đều có thể được diễn tả thông qua một chuỗi tuân theo cú pháp của chương trình. Ta gọi chuỗi này là Phoebus URL

  1. Phoebus Url có thể là một chuỗi ký tự nào đó để định danh một nguồn dữ liệu trong Phoebus. Khi chương trình tiếp nhận chuỗi PhoebusUrl, hệ thống sẽ hiểu và lấy dữ liệu đó ra.

✔️ Ví dụ các câu lệnh nhập vào phần mềm để mở các chức năng của chương trình như pbs.BO.LA.NA --> sẽ lấy bảng danh sách Tên và Địa chỉ.

  1. Phoebus Url cũng có thể là 1 câu lệnh cho phép tạo mới, sửa , xóa, tải nhập dữ liệu vào chương trình. Khi đó ta cũng có thể gọi các chuỗi này là Phoebus Command
Phoebus Url Diễn giải
pbs.BO.xxx?Arguments Nguồn từ danh sách có sẵn trong phần mềm
QD?id=QDCode?Arguments Nguồn từ Query Designer
report?$template=&$namerange= Nguồn từ report template
VUH?ViewCode= URL View - Bảng URL (pbs.BO.DATA.VUH)
RDS?DataCode= Report Dataset - Bộ dữ liệu báo cáo (pbs.BO.DATA.RDS)
url?[địa chỉ liên kết] Ngoài ra, có thể liên kết đến một địa chỉ liên kết

Sử dụng


Phoebus Url có 2 phần chính:

Định danh dữ liệu?Arguments

Arguments Tham số là gì?

Arguments cung cấp các tham số cho câu lệnh trước khi thực hiện.

Ví dụ, câu lệnh gọi tính năng Tên và địa chỉ: pbs.BO.LA.NA?AddCode=KH0001&$Action=Amend

Câu lệnh này có 2 phần như sau:

Các phần trong Arguments

Arguments được phân làm 3 loại:

  1. Dictionary - dành cho end users.

Đây là những chuỗi được truyền vào câu lệnh, giúp chọn những loại dữ liệu cần xử lý (lọc dữ liệu).

Những chuỗi của nhóm Dictionary được nối với nhau bằng ký tự &.

Đây là nhóm thường xuyên được sử dụng nhất, ở bất cứ kiểu dữ liệu nào, và cả trong lệnh UI hoặc Non-UI.

Ví dụ:

?AddCode=KH0001

&Adddress6=HCMC

&...

&...

  1. Setup tự động bởi Phoebus - users không can thiệp trực tiếp được.

Loại này không nhìn thấy được trong Arguments. Dù vậy, nhóm này được chạy ngầm trong hệ thống hoặc dùng thông qua nhóm 3- Key words.

Đây là nhóm giúp lấy ra các bảng dữ liệu hoặc đối tượng nào đó.

Có 2 dạng như sau:

  • Tự động chạy ngầm của hệ thống.

Ví dụ, tại Info List của tính năng NA, khi bấm chuột phải vào bảng để chọn lệnh Print. Đây là 1 lệnh Non-UI, hệ thống sẽ tự động lấy các mẫu tin đang có để gán vào lệnh Print để chạy.

  • Lấy dữ liệu của các bảng/đối tượng đã được định nghĩa trước.

Ví dụ, dùng bảng dữ liệu được xây dựng từ QD/RDS, hoặc trong template để truyền vào câu lệnh.

Để làm được điều này, chỉ có một phương pháp duy nhất, đó là người thiết kế phải dùng đến nhóm 3- Key words (nhóm của hệ thống).

Ví dụ:

  • có thể là 1 Table

  • có thể là nhiều Tables

  • có thể là 1 Object

  • có thể là nhiều Objects

  • ...

  1. Key words - dành cho end users.

Nhóm Key words là nhóm của hệ thống. Có 2 dạng như sau:

  • được dùng để định danh cho nhóm 2.

  • dùng cho hệ thống như Refresh, Windows, ...

Tất cả những Key words sẽ được bắt đầu bằng ký tự $ để phân biệt với nhóm 1- Dictionary.

Ví dụ, trong nhóm Dictionary có một field nào đó tên Template, nếu dùng Key words: &template=TEST để đọc dữ liệu từ template TEST thì sẽ chương trình sẽ không nhận diện được, mà sẽ lọc dữ liệu theo field Template. Do đó, cần phân biệt bằng cách &$template=TEST.

Các Key words như thường lệ được nối với nhau bằng ký tự &.

Ví dụ:

  • $data=AAA (QD Id)

  • $template=TEST

  • $refresh=Y

  • $windows=2

⚠️ Chú ý

Những tùy chọn hệ thống thường được đưa vào câu lệnh bằng Key words (bắt đầu bằng $)

$dtb=

Mở một tính năng ở một Entity khác. Ví dụ: pbs.BO.LA.NA?AddCode=0000000000&$dtb=VSA (trong đó VSA là mã Entity). Ví dụ như đang ở 1 dashboard liệt kê danh sách các PO (Purchase Order) đang đợi duyệt từ nhiều Entity. Khi người sử dụng mở 1 PO để phê duyệt thì hệ thống phải chuyển sang Entity chứa PO đó.

No Variable Meaning
1 [$CP] Current Period
2 [$CM] Current Month
3 [$T] To day
5 [$LDG] Current Ledger
6 [$UserID] Current user
7 [$f_XXXXX] Calling predefined function XXXXX. Function XXXXX is called inside the context of the formated text, it can read all parameters, which the formated text can.

Regex

Khi áp dụng tiêu chí lọc dữ liệu, ta có thể sử dụng quy tắc regex như sau:

🔔 Gợi ý

Simple RegEx Tutorial Regular Expression can be used in Content Filter conditions.

Regular Expressions can be extremely complex but they are very flexible and powerful and can be used to perform comparisons that cannot be done using the other checks available.

There follows some very basic examples of regular expression usage. For a complete description please visit www.regular-expressions.info.

' and '$' First of all, let's take a look at two special symbols: '' and '$'. These symbols indicate the start and the end of a string, respectively:

"^The"

matches any string that starts with "The".

"of despair$"

matches a string that ends in with "of despair".

"^abc$"

a string that starts and ends with "abc" - effectively an exact match comparison.

"notice"

a string that has the text "notice" in it.

You can see that if you don't use either of these two characters, you're saying that the pattern may occur anywhere inside the string -- you're not "hooking" it to any of the edges.

'', '+', and '?' In addition, the symbols '', '+', and '?', denote the number of times a character or a sequence of characters may occur. What they mean is: "zero or more", "one or more", and "zero or one." Here are some examples:

"ab*"

matches a string that has an a followed by zero or more b's ("ac", "abc", "abbc", etc.)

"ab+"

same, but there's at least one b ("abc", "abbc", etc., but not "ac")

"ab?"

there might be a single b or not ("ac", "abc" but not "abbc").

"a?b+$"

a possible 'a' followed by one or more 'b's at the end of the string:

Matches any string ending with "ab", "abb", "abbb" etc. or "b", "bb" etc. but not "aab", "aabb" etc.

Braces You can also use bounds, which appear inside braces and indicate ranges in the number of occurrences:

"ab{2}"

matches a string that has an a followed by exactly two b's ("abb")

"ab{2,}"

there are at least two b's ("abb", "abbbb", etc.)

"ab{3,5}"

from three to five b's ("abbb", "abbbb", or "abbbbb")

Note that you must always specify the first number of a range (i.e., "{0,2}", not "{,2}"). Also, as you might have noticed, the symbols '*', '+', and '?' have the same effect as using the bounds "{0,}", "{1,}", and "{0,1}", respectively.

Now, to quantify a sequence of characters, put them inside parentheses:

"a(bc)*"

matches a string that has an a followed by zero or more copies of the sequence "bc"

"a(bc){1,5}"

one through five copies of "bc."

'|' OR operator There's also the '|' symbol, which works as an OR operator:

"hi|hello"

matches a string that has either "hi" or "hello" in it

"(b|cd)ef"

a string that has either "bef" or "cdef"

"(a|b)*c"

a string that has a sequence of alternating a's and b's ending in a c

('.') A period ('.') stands for any single character:

"a.[0-9]"

matches a string that has an a followed by one character and a digit

"^.{3}$"

a string with exactly 3 characters

Bracket expressions specify which characters are allowed in a single position of a string:

"[ab]"

matches a string that has either an a or a b (that's the same as "a|b")

"[a-d]"

a string that has lowercase letters 'a' through 'd' (that's equal to "a|b|c|d" and even "[abcd]")

"^[a-zA-Z]"

a string that starts with a letter

"[0-9]%"

a string that has a single digit before a percent sign

",[a-zA-Z0- 9]$"

a string that ends in a comma followed by an alphanumeric character

You can also list which characters you DON'T want -- just use a '^' as the first symbol in a bracket expression (i.e., "%[^a- zA-Z]%" matches a string with a character that is not a letter between two percent signs).

In order to be taken literally, you must escape the characters "^.[$()|*+?{" with a backslash (''), as they have special meaning. On top of that, you must escape the backslash character itself in PHP3 strings, so, for instance, the regular expression "($|A)[0-9]+" would have the function call: ereg("(\$|A)[0-9]+", $str) (what string does that validate?)

Just don't forget that bracket expressions are an exception to that rule--inside them, all special characters, including the backslash (''), lose their special powers (i.e., "[*+?.]" matches exactly any of the characters inside the brackets). And, as the regex manual pages tell us: "To include a literal ']' in the list, make it the first character (following a possible '^'). To include a literal '-', make it the first or last character, or the second endpoint of a range."


Updated on : 2022-05-31 17:16:20. by : . at 124.158.10.141.

Topic : Syntax: Commands. pbs.bo.syntax.commands