PdcApplication.ChooseQuery

From External Bemet Wiki
Revision as of 10:31, 8 May 2014 by TC (talk | contribs)
Jump to navigation Jump to search

Declaration

ChooseQuery(SQL as String,Caption as String,KeyField as String,KeyID as String) as PdcDBTable

Description

With this function a record can be picked from a selfmade query. The result of the query is shown in a regular pick window.

KeyField is the column name that is returned when user selects a record. KeyID is a string value that is used to enable saving grid settings and grouping of the list. DO NOT USE UNDERSCORES in the KeyID.

Notes

Make sure that the KeyField and KeyID are populated. When not populated, things like grouping don't work.

Code example

The example below lets the user select a supplier for a material (with multiple supplier switched on) and return the text entered for this material/supplier record.

function fstrGetLMITxts(rstrMatNr)
dim strResult
dim strSQL
dim intLMIID
dim tblSQL

  strResult = ""
  strSQL    = "select * " &_
              "  from LMI_MAT " &_
              " where LMI_MATN = '" & rstrMatNr & "'" &_
              " order by LMI_LVNAAM"

  set tblSQL = pdc.ChooseQuery(strSQL, "Selecteer leverancier", "LMI_ID1", "LMIUS")
  strResult  = tblSQL.GetField("LMI_TEKST")

  fstrGetLMITxts = strResult

end function 'fstrGetLMITxts

Availability