sx_GetString

<< Click to Display Table of Contents >>

Navigation:  Apollo API Listing >

sx_GetString

VB Declaration

Declare Function sx_GetString Lib "Apollo9.dll"

(ByVal cpFieldName As String)

As String

C Declaration

LONG FAR PASCAL sx_GetString

(BYTEP cpFieldName);

Description

Extracts the contents of any field (less than 256 bytes wide) as a string value.

 

Note that DBF data is stored in a fixed length record in character format. Any field data (including numeric and date fields can therefore be extracted as a string.

Parameters

cpFieldName: The name of the field.

Return Value

The field contents are returned as a string.

VB Example

Sub Brw1_GetLine (cLine As String)

cLine = sx_GetString("customer") + sx_GetString("last")

End Sub

 

The following example illustrates how xBase data of any type can be extracted as a string. This is a useful function to convert an xBase date to a Visual Basic unambiguous date in the format dd-mmm-ccyy.

' Function to convert xBase date to Visual Basic unambiguous date

' xBase dates are stored as CCYYMMDD

' function returns dd-mmm-ccyy (e.g., 19931220 returns 20-Dec-1993)

Function DateToVB(FieldName As String) As String

Dim MonthString As String

Dim xBaseDate As String

 

MonthString = "xxJanFebMarAprMayJunJulAugSepOctNovDec"

If sx_Empty(FieldName) Then

DateToVB = Space$(11)

Else

DateString = sx_GetString(FieldName)

DateToVB = Right$(DateString,2) + "-" +  

Ä Mid$(MonthString, Val(Mid$, DateString, 5,2) * 3, 3) +

Ä "-" + Left$(DateString, 4)

End If

End Function

C Example

m_name->SetStrProperty("Text", (LPCSTR) sx_GetString("name"));

See Also

sx_GetTrimString