Scripting

  • 1.  I am working on a BOI integration project, and try

    Posted 11-29-2017 07:24
    I am working on a BOI integration project, and trying to make even the reads from Sage 100 via BOI rather than ODBC. If I set oData as object I can loop through all the records and test the updated value, but I would think that the PvxDispatch.nGetResultSets wold be more efficient since it allows for Filters. The trouble is, it is only giving me one record, not all of them. Code snippet, the purpose of which is to get only the recently updated records: Dim oData As ProvideX.PvxDispatch oData = oPVX.NewObject(""AP_Vendor_bus"", oSS) sColumns = ""APDivisionNo$ + """"~"""" + VendorNo$ + """"~"""" + DateUpdated$ + """"~"""" + TimeUpdated$"" sFilter = ""DateUpdated$>="" + Chr(34) + dtLastCheck.ToString(""yyyyMMdd"") + Chr(34) sKeys = ""KPRIMARY"" oData.nGetResultSets(sColumns, sKeys, sResult, sJunk, sFilter, ""0000000"", ""zzzzzzz"") Dim sResults() As String = Split(Mid(sResult, 3, Len(sResult) - 3), Chr(138)) Changing the filter setting does change WHICH one vendor I get. Leaving the Begin and End key fields blank doesn't change anything How do I get all the vendors that match the filter?


  • 2.  RE: I am working on a BOI integration project, and try

    Posted 11-29-2017 07:28
    it looks like you have 7 characters in the begin/end fields, wouldn't the KPRIMARY Key field be 9 characters (division and vendor number)?


  • 3.  RE: I am working on a BOI integration project, and try

    Posted 11-29-2017 07:31
    7,9,0 - doesn't seem to matter what I put in the key fields...


  • 4.  RE: I am working on a BOI integration project, and try

    Posted 11-29-2017 08:32
    try using chr(0) in the begin parameter and chr(254) in the end parameter.


  • 5.  RE: I am working on a BOI integration project, and try

    Posted 11-29-2017 08:43
    That got me: <Error: 548 in Method GETRESULTSETS>


  • 6.  RE: I am working on a BOI integration project, and try

    Posted 11-29-2017 08:53
    Just noticed something else, your sKeys variable looks like it is holding the index, which would be the parameter after the ""end"" parameter, not a string column name. if i recall correctly, you can't return a numeric column (without the $) unless you encase it in the providex STR() function, ie, sKeys = ""STR(KPRIMARY)"". You also might want to declare all of your variables prior to the GetResultSets, I don't see where you are declaring sResult and sJunk as a string prior to it.


  • 7.  RE: I am working on a BOI integration project, and try

    Posted 11-29-2017 09:08
    STR(KPRIMARY) did it! thank you @DavidSpeckII


  • 8.  RE: I am working on a BOI integration project, and try

    Posted 11-29-2017 09:12
    something else you can do is if you don't need keys or junk returned is to use GetResultSets like this. oData.nGetResultSets(sColumns, sColumns, sResult, sResult, sFilter, chr(0), chr(254)) This way you have don't have to worry about a junk column and you will only have one variable populated with results (sResult, vs sResult and sJunk).


  • 9.  RE: I am working on a BOI integration project, and try

    Posted 11-29-2017 09:13
    What is sJunk anyway?


  • 10.  RE: I am working on a BOI integration project, and try

    Posted 11-29-2017 09:19
    the third parameter returns the values specified by column names in the first parameter, the fourth parameter returns the values specified by column names in the second parameter. This is useful when dealing with multi-part keys. You can return a single column value in the third parameter and return the key that value came from in the fourth. An example would be vendor keys. if the second parameter was ""APDivisionNo$+VendorNo$"" then while looping through the results, if you wanted to jump to the record, you could just do a Find or SetKey on the value.