############################################################# # cb_report.sml # # Project to form a Crystal Report from TNTmips internal database records # # Author: Jeremy Johnson # # March 30, 2004 # ############################################################# #Import the Visual Basic Form $import cbsoils_report.crystal_form #create a instance of the form's class in SML class crystal_form cf; string symbol, name; numeric acres, wheat, oats, haydry, haywet; #Get a vector for input of the data vector v; GetInputVector(v); numeric num_d_records = NumRecords(v.poly.DESCRIPTN); numeric num_y_records = NumRecords(v.poly.YIELD); numeric current; #Initialize the Datatable in Visual Basic cf.InitializeDataTable(); #Add the records from the Vector to Visual Basic for current = 1 to num_d_records { symbol = TableReadFieldStr(v.poly.DESCRIPTN, "SYMBOL", current); name = TableReadFieldStr(v.poly.DESCRIPTN, "NAME", current); acres = TableReadFieldNum(v.poly.DESCRIPTN, "ACRES", current); cf.AddDescriptnRecord(symbol, name, acres); } for current = 1 to num_y_records { symbol = TableReadFieldStr(v.poly.YIELD, "SYMBOL", current); wheat = TableReadFieldNum(v.poly.YIELD, "WHEAT", current); oats = TableReadFieldNum(v.poly.YIELD, "OATS", current); haydry = TableReadFieldNum(v.poly.YIELD, "HAYDRY", current); haywet =TableReadFieldNum(v.poly.YIELD, "HAYWET", current); cf.AddYieldRecord(symbol, wheat, oats, haydry, haywet); } #Once all the records are added, create and show the report cf.InitializeReport(); cf.ShowForm();