Author Topic: BOI Variable Types  (Read 831 times)

0 Members and 1 Guest are viewing this topic.

John Spikowski

  • Posts: 36
BOI Variable Types
« on: December 29, 2017, 07:26:00 PM »
Another round of enhancements to support ByRef arguments for LONG, DOUBLE and STRING. A string byref argument can also be passed as a undef which has the same effect as argvar=""

The "VT_DISPATCH:" & objvar is no longer needed along with :SET being used when creating new objects rather than :CALL. If CBN has no arguments, :CALL is optional.

BOI COM Syntax

BOI::CREATE :SET
BOI::CBN :SET |:CALL|:LET|:GET
BOI::RELEASE

Note: CBN represents the COM/OLE Automation CallByName Windows API interface.

Test Script
Code: Script BASIC
  1. ' Script BASIC COM Buffer Test
  2.  
  3. IMPORT BOI.sbi
  4.  
  5. ' ---------------------------------------------
  6. ' Intro
  7. ' ---------------------------------------------
  8. oscript = BOI::CREATE(:SET, "ProvideX.Script")
  9. BOI::CBN oScript,"Init",:CALL,"C:\\Sage\\Sage 100 Advanced ERP\\MAS90\\HOME"
  10. osession = BOI::CBN(oscript, "NewObject", :SET, "SY_Session")
  11. BOI::CBN osession, "nSetUser", :CALL, "JRS", "MyPassword"
  12. BOI::CBN osession, "nsetcompany", :CALL, "ABC"
  13. BOI::CBN osession, "nSetDate", :CALL, "A/R", "20171119"
  14. BOI::CBN osession, "nSetModule", :CALL, "A/R"
  15. BOI::CBN osession, "nSetProgram", :CALL, BOI::CBN(osession, "nLookupTask", :CALL, "AR_Customer_ui")
  16. ocust = BOI::CBN(oscript, "NewObject", :SET, "AR_Customer_bus", osession)
  17. BOI::CBN ocust, "nMoveFirst"
  18.  
  19. ' ---------------------------------------------
  20. ' Test BYREF UNDEF Buffers (default to STRING):
  21. ' ---------------------------------------------
  22. ' UNDEF by first occurence
  23. BOI::CBN ocust, "nGetValue", :CALL, "CustomerNo$", CustomerNo
  24.  
  25. ' UNDEF by command
  26. Undef CustomerName
  27. BOI::CBN ocust, "nGetValue", :CALL, "CustomerName$", CustomerName
  28.  
  29. ' UNDEF by assignment
  30. City = Undef
  31. BOI::CBN ocust, "nGetValue", :CALL, "City$", City
  32.  
  33.  
  34. ' ---------------------------------------------
  35. ' Test Explicit BYREF STRING Buffers:
  36. ' ---------------------------------------------
  37. 'Must be empty "" else treated as literals
  38. State = ""
  39. TelephoneNo = ""
  40.  
  41. BOI::CBN ocust, "nGetValue", :CALL, "State$", State
  42. BOI::CBN ocust, "nGetValue", :CALL, "TelephoneNo$", TelephoneNo
  43.  
  44.  
  45. ' ---------------------------------------------
  46. ' Test Explicit BYREF Numeric Buffers
  47. ' ---------------------------------------------
  48. ' Must be 0 else treated as literals
  49. everestFlg = 0
  50. modLevel = 0.0
  51. convLevel = 0
  52.  
  53. retval = BOI::CBN(osession, "nGetModuleInfo", :CALL, "A/R", everestFlg, modLevel, convLevel)
  54.  
  55.  
  56. ' ---------------------------------------------
  57. ' Done Testing
  58. ' ---------------------------------------------
  59. BOI::CBN ocust, "DropObject"
  60. BOI::CBN osession,"DropObject"
  61. BOI::RELEASE oscript
  62.  
  63.  
  64. ' ---------------------------------------------
  65. ' Display Results
  66. ' ---------------------------------------------
  67. PRINT "Customer:  " & CustomerNo & " | " & CustomerName & " | " & City & " | " & State & " | " & TelephoneNo, "\n"
  68. PRINT "Module Info: \nOK: " & retval & "\nEverest Flag: " & everestFlg & "\nModule Level: " & Format("%.1f", modLevel) & "\nConversion Level: " & convLevel, "\n"
  69.  

Output

C:\ScriptBASIC\examples>scriba byreftest.sb
Customer:  ABF | American Business Futures | Milwaukee | WI | (414) 555-4787
Module Info:
OK: 1
Everest Flag: 1
Module Level: 5.2
Conversion Level: 5

C:\ScriptBASIC\examples>

« Last Edit: January 03, 2018, 09:30:40 PM by John Spikowski »