| Stonefield Query SDK |
| PromptUserForValue |
Syntax
PromptUserForValue(Prompt as String, Caption as String, Default as String) as String
Parameters
Prompt
The prompt message to display to the user.
Caption
The caption for the dialog.
Default
The default for the value.
Return Value
The value the user entered; blank if the user clicked the Cancel button.
Example
Here's an example that retrieves the location for the AR tables from the AR Location entry in the [Custom Settings] section of the SFQUERY.INI file for the project. If the entry is blank (such as when this code is executed for the first time), the user is prompted for the value and it's stored in the INI file. This code goes into the DataEngine.GetCustomMetaData script.
Visual FoxPro
lparameters toApplication as SQApplication
local lcINIFile, lcLocation, lnI, loTable as Table
lcINIFile = toApplication.ProjectDirectory + 'SFQUERY.INI'
lcLocation = toApplication.GetINIValue(lcINIFile, ;
'Custom Settings', 'AR Location')
if empty(lcLocation)
lcLocation = toApplication.PromptUserForValue('Location of AR Tables')
toApplication.SetINIValue(lcINIFile, ;
'Custom Settings', 'AR Location', lcLocation)
endif
if not empty(lcLocation)
for lnI = 1 to toApplication.DataEngine.Tables.Count
loTable = toApplication.DataEngine.Tables.Item(lnI)
do case
case left(loTable.Alias, 2) <> 'AR'
case lcValue = 'Y'
loTable.Location = lcLocation
otherwise
loTable.Reportable = .F.
endcase
next
endif VBScript
function Main(Application)
dim Table
INIFile = Application.ProjectDirectory + "SFQUERY.INI"
Location = Application.GetINIValue(INIFile, "Custom Settings", _
"AR Location")
if Location = "" then
Location = Application.PromptUserForValue("Location of AR Tables")
Application.SetINIValue INIFile, _
"Custom Settings", "AR Location", Location
end if
if Location <> "" then
for I = 1 to Application.DataEngine.Tables.Count
set Table = Application.DataEngine.Tables.Item(I)
if left(Table.Alias, 2) = "AR" then
if Value = "Y" then
Table.Location = Location
else
Table.Reportable = False
end if
end if
next
end if
end function JavaScript
function Main(Application) {
var INIFile, Location, I, Table ;
INIFile = Application.ProjectDirectory + 'SFQUERY.INI' ;
Location = Application.GetINIValue(INIFile, 'Custom Settings',
'AR Location') ;
if (Location = '') {
Location = Application.PromptUserForValue('Location of AR Tables') ;
Application.SetINIValue(INIFile,
'Custom Settings', 'AR Location', Location) ;
}
if (Location <> '') {
for (I = 1; I <= Application.DataEngine.Tables.Count; I++) {
Table = Application.DataEngine.Tables.Item(I) ;
if (left(Table.Alias, 2) = 'AR') {
if (Value = 'Y') {
Table.Location = Location ;
}
else {
Table.Reportable = false ;
}
}
}
}
}See Also
Application Object
| Last Updated: 02/05/2008 |