| LinkarClientSelectAsync Method |
Linkar Framework for .NET and Core
Executes a Query in the Database, in a asynchronous way with JSON output format.
Namespace: Linkar.Functions.Persistent.JSONAssembly: Linkar.Functions.Persistent.JSON (in Linkar.Functions.Persistent.JSON.dll) Version: 2.3.1
Syntax public Task<string> SelectAsync(
string filename,
string selectClause = "",
string sortClause = "",
string dictClause = "",
string preSelectClause = "",
SelectOptions selectOptions = null,
JSON_FORMAT jsonFormat = JSON_FORMAT.JSON,
string customVars = "",
int receiveTimeout = 0
)
Public Function SelectAsync (
filename As String,
Optional selectClause As String = "",
Optional sortClause As String = "",
Optional dictClause As String = "",
Optional preSelectClause As String = "",
Optional selectOptions As SelectOptions = Nothing,
Optional jsonFormat As JSON_FORMAT = JSON_FORMAT.JSON,
Optional customVars As String = "",
Optional receiveTimeout As Integer = 0
) As Task(Of String)
public:
Task<String^>^ SelectAsync(
String^ filename,
String^ selectClause = L"",
String^ sortClause = L"",
String^ dictClause = L"",
String^ preSelectClause = L"",
SelectOptions^ selectOptions = nullptr,
JSON_FORMAT jsonFormat = JSON_FORMAT::JSON,
String^ customVars = L"",
int receiveTimeout = 0
)
member SelectAsync :
filename : string *
?selectClause : string *
?sortClause : string *
?dictClause : string *
?preSelectClause : string *
?selectOptions : SelectOptions *
?jsonFormat : JSON_FORMAT *
?customVars : string *
?receiveTimeout : int
(* Defaults:
let _selectClause = defaultArg selectClause ""
let _sortClause = defaultArg sortClause ""
let _dictClause = defaultArg dictClause ""
let _preSelectClause = defaultArg preSelectClause ""
let _selectOptions = defaultArg selectOptions null
let _jsonFormat = defaultArg jsonFormat JSON_FORMAT.JSON
let _customVars = defaultArg customVars ""
let _receiveTimeout = defaultArg receiveTimeout 0
*)
-> Task<string>
Parameters
- filename String
- Name of file on which the operation is performed. For example LK.ORDERS
- selectClause String (Optional)
- Statement fragment specifies the selection condition. For example WITH CUSTOMER = '1'
- sortClause String (Optional)
- Statement fragment specifies the selection order. If there is a selection rule, Linkar will execute a SSELECT, otherwise Linkar will execute a SELECT. For example BY CUSTOMER
- dictClause String (Optional)
- Space-delimited list of dictionaries to read. If this list is not set, all fields are returned. For example CUSTOMER DATE ITEM. You may use the format LKFLDx where x is the attribute number.
- preSelectClause String (Optional)
- An optional command that executes before the main Select
- selectOptions SelectOptions (Optional)
- Object with options to manage how records are selected, including calculated, dictionaries, conversion, formatSpec, originalRecords, onlyItemId, pagination, regPage, numPage.
- jsonFormat JSON_FORMAT (Optional)
- Enum JSON_FORMAT specifies the desired output format: standard JSON, JSON_DICT format, or JSON_SCH format
- customVars String (Optional)
- Free text sent to the database allows management of additional behaviours in SUB.LK.MAIN.CONTROL.CUSTOM, which is called when this parameter is set.
- receiveTimeout Int32 (Optional)
- Maximum time in seconds that the client will wait for a response from the server. Default = 0 to wait indefinitely.
Return Value
TaskStringThe results of the operation.
Remarks
In the preSelectClause argument these operations can be carried out before executing the Select statement:
- Previously call to a saved list with the GET.LIST command to use it in the Main Select input
- Make a previous Select to use the result as the Main Select input, with the SELECT or SSELECT commands.In this case the entire sentence must be indicated in the PreselectClause. For example:SSELECT LK.ORDERS WITH CUSTOMER = '1'
- Exploit a Main File index to use the result as a Main Select input, with the SELECTINDEX command. The syntax for all the databases is SELECTINDEX index.name.value. For example SELECTINDEX ITEM,"101691"
Example using Linkar;
using Linkar.Functions.Persistent.JSON;
class Test
{
public string MySelect()
{
string result = "";
try
{
CredentialOptions credentials = new CredentialOptions("127.0.0.1", "EPNAME", 11300, "admin", "admin");
LinkarClient client = new LinkarClient();
client.Login(credentials);
result = client.SelectAsync("LK.CUSTOMERS").Result;
client.Logout();
}
catch (Exception ex)
{
string error = ex.Message;
}
return result;
}
}
Imports Linkar
Imports Linkar.Functions.Persistent.JSON
Class Test
Public Function MySelect() As String
Dim result As String = ""
Try
Dim credentials As CredentialOptions = New CredentialOptions("127.0.0.1", "EPNAME", 11300, "admin", "admin")
Dim client As LinkarClient = New LinkarClient()
client.Login(credentials)
result = client.SelectAsync("LK.CUSTOMERS").Result
client.Logout()
Catch ex As Exception
Dim[error] As String = ex.Message
End Try
Return result
End Function
End Class
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also