1 2 Previous Next 28 Replies Latest reply on May 25, 2011 11:29 AM by 642338

    URGENT!! NEED HELP IN VB SCRIPTING IN FDM

    858234
      Hi Guys,

      I want to write a scipt in the BefImportMap under Events Scipts.

      The reason is when any user imports the mapping table(in my case an excel .xls doc), if the user imports any other excel by mistake then the mapping goes wrong and affects the application.

      So I want to validate the imported excel by putting condition say:

      i) (1, B) must be LOCATION
      ii) (3, B) must be either of these--Account, Entity, Icp, C1, C2, C3 & C4.

      If these conditions satisfy only then the user can import the mapping excel sheet, otherwise the user will see an error.

      Please help me in this, and FYI I am novice in VB scripting.
      Thanks in advance.

      Regards
      Sandy
        • 1. Re: URGENT!! NEED HELP IN VB SCRIPTING IN FDM
          858234
          Hey guys can any one help.......
          • 2. Re: URGENT!! NEED HELP IN VB SCRIPTING IN FDM
            852598
            It's not clear to me what kind of conditions would you like to apply.

            In my case, the only, not really elegant, solution is to put a failing statement in the IF THEN ELSE block. For example

            '________________ Code Block
            Dim fso
            Set fso = CreateObject("Scripting.FileSystemObject")

            If satisfied_condition Then
            ' do something
            Else
            fso.getFile("ThisFileNotExists") ' this would give an error condition aborting the whole import map process
            End if
            '_____________________________________

            Try to read some VBScript example to understand how to write code correctly.
            1 person found this helpful
            • 3. Re: URGENT!! NEED HELP IN VB SCRIPTING IN FDM
              858234
              Thanks a lot for replying.

              the function under befImportMap is Sub BefImportMap(strLoc, strType, strFile)

              so when a user imports a excel file it must be validated before loading

              according the map_loader template, cell (b,1) has location

              so i have to compare strLoc with cell (b,1)
              if this condition fails then abort the import map process.

              also according the map_loader template, cell (b,3) has any of the 1 dimension: account, entity, icp or custom(1 - 4)
              i want to check whether cell (b, 3) has really those dimensions.

              If NO, abort the import process.


              Hope now it is clear, pls reply.
              I am a beginner in VB so understood the logic, dats y wanna help in the event script.

              Thanks in advance


              Sandy
              • 4. Re: URGENT!! NEED HELP IN VB SCRIPTING IN FDM
                Jeo123
                I think you're misunderstanding when that script is run. That doesn't run before a map import, it runs before a data import(The fish process). As far as I know what you're asking for isn't possible through event scripting.
                • 5. Re: URGENT!! NEED HELP IN VB SCRIPTING IN FDM
                  TonyScalese
                  Jeo, you are thinking about the BefFileImport event script. The befMapImport event script can be used to do this.
                  • 6. Re: URGENT!! NEED HELP IN VB SCRIPTING IN FDM
                    LarryR
                    Sandy, what version of FDM are you using? It seems like quite a few users are reporting that map imports are bungling the mapping tables. I'm stuck back on FDM 9.3.1 for the time being, but I've imported mapping tables from Excel dozens of times & have not seen existing maps bungled by an improper mapping file format. FDM doesn't do anything for us with a bad map file format, including reporting errors. But, if existing map bungling is new to FDM 11.x, then perhaps users should be reporting this to Oracle support as a bug so it can be fixed & us users don't have to code around it. Just my 2 cents.
                    • 7. Re: URGENT!! NEED HELP IN VB SCRIPTING IN FDM
                      858234
                      Hi Tony,

                      I know it can be done through BefImportMap event script.

                      But I have no idea how to fetch that particular path what the user is browsing and uploading as a mapping excel file.

                      I want to put some conditions to check that excel file with the mapping template.
                      If it fails the mapping process must be aborted.

                      I want to do this becoz when a user imports a wrong file, junk value comes in the mapping grid.
                      For that i have delete the LOCATION and map the correct file again

                      Please help tony. Stuck with it for a long time.

                      Thanks
                      Sandy
                      • 8. Re: URGENT!! NEED HELP IN VB SCRIPTING IN FDM
                        SH_INT
                        My suggestion would be to make users save their maploader templates with a filename that uses a specified prefix e.g. Maploader_MyMappings.xls. Check for the prefix ('Maploader_' - you can get this from the strFile input param of the event) when the file is imported and if it doesn't contain it reject the file and pop up an iformation message telling the user to rename file and validate its a mapping file.
                        1 person found this helpful
                        • 9. Re: URGENT!! NEED HELP IN VB SCRIPTING IN FDM
                          858234
                          Thanks a lot
                          I got it what u r saying.

                          Ill try it and get back to u
                          • 10. Re: URGENT!! NEED HELP IN VB SCRIPTING IN FDM
                            858234
                            Can you elaborate by giving some scripting example, so that i can understand the syntax.
                            And shall I write that script under befMapimport?
                            Thanks in advance
                            • 11. Re: URGENT!! NEED HELP IN VB SCRIPTING IN FDM
                              858234
                              I wrote the following script, but when i am importing a file which doesnt have "maploader" string in its name, it gets loaded, doesnt throw the error

                              PLESE WRITE BACK, HELPPPPPP


                              Sub BefImportMap(strLoc, strType, strFile)
                              '------------------------------------------------------------------
                              'Oracle Hyperion FDM EVENT Script:
                              '
                              'Created By:      hypadmin
                              'Date Created:      2011-04-29-14:19:56
                              '
                              'Purpose:
                              '
                              '------------------------------------------------------------------

                                   

                                   
                                   'Declare local variables
                              Dim lngStartPosition
                              Dim strSearchValue
                              Dim lngPosition

                              'Define starting position and search string
                              lngStartPosition = 1
                              strSearchValue = "Maploader"

                              'Execute the search (Not case sensitive)
                              lngPosition = InStr(lngStartPosition, strFile, strSearchValue, 1)

                              'Test the Results
                              If Not lngPosition > 0 Then
                              'String Found
                                   'Declare local variables
                                   Dim strMessage
                                   
                                   'Set the message value
                                   strMessage = "INCORRECT"
                                   
                                   If LCase(API.DataWindow.Connection.PstrClientType) = "workbench" Then
                                        'Win32 Client (Use Msgbox)
                                        MsgBox strMessage
                                   Else
                                        'Web Client (Set API action properties)
                                        RES.PlngActionType = 2                    '(See Enumeration: ScriptActionTypes)
                                        RES.PstrActionValue = strMessage
                                   End If


                              End If

                                   

                              End Sub
                              • 12. Re: URGENT!! NEED HELP IN VB SCRIPTING IN FDM
                                beyerch2
                                --------------------------------------


                                Sub BefImportMap(strLoc, strType, strFile)
                                '------------------------------------------------------------------
                                'Oracle Hyperion FDM EVENT Script:
                                '
                                'Created By: hypadmin
                                'Date Created: 2011-04-29-14:19:56
                                '
                                'Purpose:
                                '
                                '------------------------------------------------------------------




                                'Declare local variables
                                Dim lngStartPosition
                                Dim strSearchValue
                                Dim lngPosition


                                'Define starting position and search string
                                lngStartPosition = 1
                                strSearchValue = "Maploader"

                                'Execute the search (Not case sensitive)
                                lngPosition = InStr(lngStartPosition, strFile, strSearchValue, 1)

                                'Test the Results
                                If lngPosition < 1 then
                                'String NOT Found
                                'Declare local variables
                                Dim strMessage

                                'Set the message value
                                strMessage = "INCORRECT"

                                If LCase(API.DataWindow.Connection.PstrClientType) = "workbench" Then
                                'Win32 Client (Use Msgbox)
                                MsgBox strMessage
                                Else
                                'Web Client (Set API action properties)
                                RES.PlngActionType = 2 '(See Enumeration: ScriptActionTypes)
                                RES.PstrActionValue = strMessage
                                End If

                                End If

                                End Sub
                                • 13. Re: URGENT!! NEED HELP IN VB SCRIPTING IN FDM
                                  858234
                                  Did u copy & pasted the same script dear???

                                  Please clarify where I am wrong?

                                  Thanks
                                  • 14. Re: URGENT!! NEED HELP IN VB SCRIPTING IN FDM
                                    TonyScalese
                                    Sandy,

                                    You might want to download a compare tool and compare the 2 scripts. There is a subtle difference between what you wrote and what Charles provided.
                                    1 2 Previous Next