Announcement

Collapse
No announcement yet.

is it possible to run user defined function inside MvDo with Name and Value specified

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    is it possible to run user defined function inside MvDo with Name and Value specified

    I did some testing with MvDo over the weekend. Based on some of the LSK documents, it appeared as though it was possible to run user defined functions contained within the same .mvc while still using a specified Name and Value. Unfortunately my testing seemed to indicate that the user defined functions were ignored. Is it possible to use MvDo with user defined functions inside the function called in the MvDo? I was hoping it was as I would like to build what in essence becomes a library file, while not having to worry about every MvAssign being carried through to the script calling the MvDo.

    #2
    Hi BigDummy,

    Can you give an example of what you're trying to do? I don't quite follow what you are trying to do.
    David Carver
    Miva, Inc. | Software Developer

    Comment


      #3
      So I'm trying to rewrite and add to some code that reaches out to vendor api's and sites to collect their inventories for use in calculating the quantity available of specific parts. I thought that the MvDo command would do well to create a "library" code that could be used in several places within our site. Essentially, I'm writing a .mvc file that contains a function named GetVendorInventory. Within that same .mvc are three user defined functions that I wish to call from within the GetVendorInventory function. But when I run the call:

      <MvDo File="{l.TargetPath}" Name="l.GetVendorInventory" Value="{l.TargetPart}">

      The VendorInventoryD, C, and S have a value of zero. All three functions are defined within the same .mvc file as the GetVendorInventory function, but they appear to be skipped over. Now I know that the documentation says only the called function will run, but I have seen in the LSK where it appears that other functions defined in the same .mvc file can run despite the seemingly singular focus on the function defined in the Name value.

      A snippet of the function called in the MvDo is below.

      <MvFunction Name="GetVendorInventory" Parameters="PartNumber">

      <MvAssign Name="l.VendorInventoryD" Value="{GetDInventory(l.PartNumber)}">
      <MvAssign Name="l.VendorInventoryC" Value="{GetCInventory(l.PartNumber)}">
      <MvAssign Name="l.VendorInventoryS" Value="{GetSInventory(l.PartNumber)}">

      Comment


        #4
        It sounds like your GetDInventory, GetCInventory, GetSInventory functions are broken / not working as expected. If you call GetVendorInventory, all the code within that function will be run. You should add some debug code to see what is / isn't getting called. You could also turn on trace logging to see what is happening.
        David Carver
        Miva, Inc. | Software Developer

        Comment


          #5
          I know that the GetDInventory should work. It was copied, with minor trimming of debug/commented out code, from a working function in a test .mvc file I had written to prove out that particular function. The others were existing functional and proven functions directly from a currently working script, so they should also work.

          Also, I doubt that this would be related, but when I first tried to run my test mvc that calls the GetVendorInventory function, it would not work. Every path I specified, be it absolute or relative, would fail. Only when I put the two mvc's in the same folder would it work. It's really strange.

          After a little research, I have to "install" diagtool.mvc and turn on logging there? Sounds like something best to do when site traffic is low.

          Comment

          Working...
          X