1.7 Getting positions of members according to primary key values
In the following product category table, ID field is the primary key. The task is to find ordinal number of the member whose ID field value is 5.
Category |
---|
ID |
Name |
Description |
… |
SPL script:
A | |
---|---|
1 | =connect(“db”) |
2 | =A1.query@x(“select * from Category”).keys(ID) |
3 | =A2.pfind(5) |
A1 Connect to the database;
A2 Retrieve Category table from the database and set ID as the primary key;
A3 Find ordinal number of the record whose primary key value is 5. If the desired primary key value does not exist or no primary key is defined, pfind() function returns 0.
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProcSPL
SPL Learning Material 👉 https://c.scudata.com
SPL Source Code and Package 👉 https://github.com/SPLWare/esProc
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProc_SPL