|
The QMExtract() function extracts a field, value or subvalue from a dynamic array. It is analogous to the QMBasic field extraction operator or the EXTRACT() function.
The function arguments are:
| Src | is the dynamic array to be processed |
| Fno | is the number of the field to be extracted. If less than 1, 1 is assumed |
| Vno | is the number of the value to be extracted. If less than 1, the entire field is extracted. |
| Svno | is the number of the subvalue to be extracted. If less than 1, the entire value is extracted. |
The QMExtract() function returns the given field, value or subvalue from the source string. If the required item is not found, a null string is returned.
This function is evaluated on the client system and does not require a server connection to be open.
The example program fragments below read the record identified by ClientNo from the file open as fClients and then extracts field 4 from it. A real program should test the status from the read to determine if the action was successful.
char * QMExtract(char * Src, int Fno, int Vno, int Svno)
Rec = QMRead(fClients, ClientNo, Err);
CliAddr = QMExtract(Rec, 4, 0, 0);
Note that variables Rec and CliAddr point to dynamically allocated memory areas that must be released using QMFree() when no longer needed.
|
QMExtract(ByVal Src as String, ByVal Fno as Integer, ByVal Vno as Integer, ByVal Svno as Integer) as String
Rec = QMRead(fClients, ClientNo, Err)
CliAddr = QMExtract(Rec, 4, 0, 0)
|
This function is not supported by the QMClient class module as it is a QMBasic function.
|
String Extract(String Src, int Fno, int Vno, int Svno)
Rec = qm.Read(fClients, ClientNo);
CliAddr = qm.Extract(Rec, 4, 0, 0);
|
Extract(Src, Fno, Vno, Svno)
Rec, Err = qm.Read(fClients, ClientNo)
CliAddr = qm.Extract(Rec, 4, 0, 0)
|
|