Here is the example for using a XResultSet given in the commands/functions help in the SBasic editor, modified to be closer to what you need.
To get to function/command help in the SBasic editor, right click on the surface of the SBasic editor and select "List Browser" from the menu that appears. Type the first few letters of a command or function to scroll right to that function. Many have full examples.
This example show you how to use more than one search criteria and how to retrieve a field value
#include "sbasic_include.sbas"
var vRSHandle as int
var vNoOfRecords as int
var vLoop as int
var vSearchCriteria1 as string
var vSearchCriteria2 as string
var vProduct as string
var vProductList as string
// clear the list
vProductList = ""
// set the search criteria to match values from other combos
vSearchCriteria1 = "!Supplier=" + supplier
vSearchCriteria2 = "!Category=" + category
// get records matching the two combo box values
vRSHandle = @XResultSetSearch(@fn, "YourForm", SEARCH_MODE_AND, SEARCH_SYNTAX_QA, search_criteria1, search_criteria2)
// make sure we got an open result set
if(vRSHandle > -1)
{
// how many records did we get
vNoOfRecords = @XResultSetTotal(vRSHandle)
// loop through the records
for vLoop = 1 to vNoOfRecords
// set the record counter to the loop
XResultSetCurrentPosition(vRSHandle, vLoop)
// get the value of the product field
vProduct = @XResultSetValue(vRSHandle, "Product")
// add the value to the list
vProductList = @AppendStringArray(vProductList, vProduct)
next
// use the list to populate the combo box
PopulateListElement(Product, vProductList)
// close the result set
XResultSetClose(vRSHandle)
}
Of course, you may need to adjust things to match your actual field and element names.