6 Replies Latest reply on Sep 16, 2011 5:56 AM by shiv2

    fMapItemLookup - Plz help !!

    886365
      Hi all,

      Can anyone please explain how to call this function " fMapItemLookup " with an example. I have gone through API guide on this function but couldn't able to follow the actual process where we can use this function exacly and how to call this. Your responce is appreciated.

      Thank you in advance !!
        • 1. Re: fMapItemLookup - Plz help !!
          Robb Salzmann
          Hi James,

          I feel your pain. I don't think the designers of FDM ever intended the end user/admin to get around to using that functionality, as this is all that exists in the docs:

          API Guide:
          Description
          Lookup a single Item from the table tDataMap for the specified location key. This procedure is intended to be used for
          scripting lookup calls against a lookup dimension.
          Parameter(s)
          ByVal lngPartKey As Variant, ByVal strDim As Variant, ByVal strItem As Variant
          lngPartKey Numeric ID of the Location to process
          strDim Text identifier for the dimension to process/lookup map for (Valid Values: Account,
          Entity, ICP, UD1-UD8)
          strItem Text based Key value to lookup
          Return Type>

          Admin Guide:
          Use As Lookup
          You use the Use as Lookup column to select a dimension for a custom lookup table. When Use as Lookup is selected, the Enabled field cannot be used. The custom lookup dimension is used only for custom scripting.
          >

          Oddly, Use as Lookup is a check box on the dimension properties, not a "column" used to select a dimension. So basically "use as lookup" as described here means that something can be used to look something else up in a custom script.

          If you want a straightforward lookup, just create a key/value pair SQL table. Very simple, understood by almost anyone, accomplishes the same thing.

          Regards,
          Robb Salzmann
          1 person found this helpful
          • 2. Re: fMapItemLookup - Plz help !!
            886365
            Thank you for the rep,

            Can you correct this,

            Function work (strField, strRecord)
            Dim temp
            temp = Left(strField, 3)
            API.DataWindow.SqlMgr.fMapItemLookup 790 Custom10 temp
            End Function

            ERROR is:

            Error: An error occurred running the script:
            1025 - Expected end of statement
            At Line: 4


            790 is the location ID, Customer 10 is strDim, temp is strItem.

            Edited by: james on Sep 15, 2011 4:32 AM
            • 3. Re: fMapItemLookup - Plz help !!
              SH_INT
              Try this:


              Function work (strField, strRecord)
              Dim temp
              temp = Left(strField, 3)
              work = API.DataWindow.SqlMgr.fMapItemLookup 790,"Custom10",temp
              End Function
              • 4. Re: fMapItemLookup - Plz help !!
                Robb Salzmann
                Hi James,

                It looks like you're starting to figure it out :)

                Custom10 is not a valid dimension for fMapItemLookup. It needs to be one of:
                "Account"
                "Entity"
                "ICP"
                "UD1"
                "UD2"
                ...
                "UD8"

                This may help(you need to figure which UD dim you're looking up):
                Function work (strField, strRecord)
                   work = API.DataWindow.SqlMgr.fMapItemLookup( 790, "UD8",  Left(strField, 3))
                End Function
                Regards,
                Robb Salzmann
                1 person found this helpful
                • 5. Re: fMapItemLookup - Plz help !!
                  886365
                  Thanks Robb and SH for the answer :)

                  Well, Robb I have tried your code but still facing error

                  " Error: An error occurred running the script:
                  438 - Object doesn't support this property or method: 'DW.Utilities.SqlMgr' "

                  This is a big challenge for me now !! How to call a function within/ outside the script....!! Can you help me buddy.. :)

                  Thanks in advance !!
                  • 6. Re: fMapItemLookup - Plz help !!
                    shiv2
                    Hello James!!

                    Please use as below,SQLMgr is a class of API, so no need to use DataWindow.

                    Function work(strField, strRecord)

                    work=*API.SqlMgr.fMapItemLookup* (740,"UD8",Left(strField,3))

                    End Function

                    Thanks,
                    Shivendra