Serial numbers via sql query

Hi,
I'm having trouble getting the correct serial numbers via SQL.
From PHP I run the following query to get the Delivery Notes:
select ODLN.DocEntry,ODLN.CardCode,ODLN.CardName,ODLN.DocDueDate,ODLN.DocDate,ODLN.NumAtCard,NNM1.SeriesName,ODLN.DocNum,ODLN.SlpCode,ODLN.CANCELED,ODLN.DocStatus,DLN1.ItemCode,DLN1.Dscription,DLN1.Quantity,DLN1.ShipDate,DLN1.LineStatus,ODLN.NumAtCard,ODLN.U_CodSit,ODLN.DocTotal,ODLN.DocCur,ODLN.CreateDate,ODLN.TrackNo,DLN1.SerialNum from ODLN INNER JOIN NNM1 ON (ODLN.Series = NNM1.Series) INNER JOIN OCRD ON (ODLN.CardCode = OCRD.CardCode AND OCRD.CardCode = '".$_POST["sapcode"]."' AND OCRD.Password = '".$_POST["sappwd"]."') INNER JOIN DLN1 ON ODLN.DocEntry = DLN1.DocEntry ORDER BY ODLN.CreateDate DESC,ODLN.DocEntry ASC
While I loop through the results I then try to grab the serial numbers. I tried this:
SELECT OSRI.IntrSerial FROM OSRI INNER JOIN SRI1 ON ( (SRI1.SysSerial = OSRI.SysSerial) AND (SRI1.BaseNum = ".$row['DocNum'].") ) INNER JOIN DLN1 ON (DLN1.DocEntry = SRI1.BaseEntry) WHERE ( (DLN1.DocEntry = ".$row['DocEntry'].") AND (DLN1.ItemCode = OSRI.ItemCode) AND (DLN1.ItemCode = '".$row['ItemCode']."') ) ORDER BY OSRI.IntrSerial
but it gives me incoherent results compared to what appears in the SAP b1 client. For ex., some serial numbers are fine but in other cases I get more serial numbers than accounted for (article quantity = 1 but get 2 serial numbers; in SAP B1 client only one of the two serial numbers appears, as expected).
So I then modified the query and added a check for the CardCode:
SELECT OSRI.IntrSerial FROM OSRI INNER JOIN SRI1 ON ( (SRI1.SysSerial = OSRI.SysSerial) AND (SRI1.BaseNum = ".$row['DocNum'].") AND (SRI1.CardCode = '".$_POST["sapcode"]."') ) INNER JOIN DLN1 ON (DLN1.DocEntry = SRI1.BaseEntry) WHERE ( (OSRI.CardCode = '".$_POST["sapcode"]."') AND (DLN1.DocEntry = ".$row['DocEntry'].") AND (DLN1.ItemCode = OSRI.ItemCode) AND (DLN1.ItemCode = '".$row['ItemCode']."') ) ORDER BY OSRI.IntrSerial
This query is slightly better in the sense that at least I don't get serial numbers that are not supposed to be there (eg. if quantity=1 I will not get 2 serial numbers as in the previous query). However, in some cases it works as expected and in other delivery notes it doesn't because it simply doesn't list the serial numbers (which where found in the first query).
It might be because the CardCode field isn't always thoroughly set?
If so, is it just a "user problem" so I should tell my company to review the way they fill SAP data?
Or am I doing the wrong query?
(The SDK doc regarding OSRI is confusing as it doesn't even point to SRI1 and I don't fully understand the relationships)
Regards,
Vieri

Vieri,
you can catch (using MS SQL Profiler) the query which is executed by SBO once you click on serial nambers report from Delivery Note form.
this is one of the ways to get a solution quickly.

Similar Messages

  • SSIS execution via sql query with dtexec utility by passing proxy account

    Hi, 
    i am executing ssis package with dtexec utility, with xp_cmdshell
    package is not a file based, but stored in sql/msdb
    while executing i am getting 'authentication failed'
    i haved tried with sa user and password, by passing it...but no luck
    so finally i want to authenticate it via proxy account, because same happen in sql agent job also but after creating proxy account it worked.
    please suggest me way to pass proxy account in query....i have used many combination like
    SET @SQLQuery = 'DTExec /SQL ^"\DataTransfer.dtx^" '
    SET @SQLQuery = @SQLQuery + ' /SET \Package.Variables[ServerName].Value;^"'+ @ServerName + '^" '
    EXEC master..xp_cmdshell @SQLQuery

    Have the EXEC master..xp_cmdshell run a batch instead that inside it it has a run as DOS command that runs the package with DTExec
    Arthur My Blog

  • Ignore illegal numbers in SQL query

    We have a VARCHAR2 column in a table. In a SELECT statement want to be able to do arithmetic on the values in the column provided they are valid numbers. For rows where the value is not numeric assume a zero or Null result or if that is not possible only return the rows where the value is a valid number.
    Using the to_number function returns Oracle errors of
    ORA-01722: invalid number
    [Oracle Database is part of a package which gives us facilities to write select statements to query the package data but not write our own functions]

    This may not be the most efficient for a large result set, but you could use a function which looks something like ...
    create or replace function my_to_number(strParam in Varchar2) return number is
         intPos Integer;
         notNumber Boolean;
    begin
         intPos := 0;     
         notNumber := False;
         Loop
              intPos := intPos + 1;     
              notNumber := (ascii(substr(strParam,intPos,1)) < 48 or ascii(substr(strParam,intPos,1)) > 57) and
              ascii(substr(strParam,intPos,1)) != 46;
              Exit When intPos = length(strParam) or notNumber;
         End Loop;
         If notnumber then
              return null;
         Else
              return to_number(strParam);
         End If;
    end;
    or simply handle the exceoption in the function ...
    create or replace function my_to_number(strParam in Varchar2) return number is
    tempResult Number;
    begin
         tempResult := to_number(strParam);
         return tempResult;
         Exception
         When Others then
              return null;
    end;

  • Creating User account via SQL query

    Hi,
    Is it possible to create a user account programmatically?
    thanks,
    Dekel

    In SQL, use the CREATE USER statement. In PL/SQL, see Re: Creating user in PL/sql procdure.

  • Delivery notes and serial numbers

    Hi
    I have a simple SQL question.
    How do I get the serial numbers in "plain SQL"?
    The SDK "Help Center" shows that I can get the delivey notes from the ODLN table and then dig into the DLN1 rows and get the list of items. However, serial numbers are within the OSRI table (OSRI.IntrSerial).
    How can I "bridge" DLN1 with OSRI? Or, how do I get all serial numbers related to an item of a delivery note in "simple SQL selects"?

    Hi Vieri.
    You have to link to table SRI1 where saves the transactions you made with transactional documents where includes items with serial numbers. The query could be as follows:
    SELECT ODLN.DOCDATE, ODLN.DOCNUM, OSRI.SUPPSERIAL  FROM OSRI
    JOIN SRI1 ON (SRI1.SYSSERIAL = OSRI.SYSSERIAL)
    JOIN ODLN ON (ODLN.DOCENTRY = SRI1.BASEENTRY)
    JOIN DLN1 ON (DLN1.ITEMCODE = OSRI.ITEMCODE)
    WHERE ODLN.DOCENTRY = 5
    ORDER BY ODLN.DOCDATE DESC
    I don´t know by the moment if via SDK you can read this information.
    I hope it helps.
    Best regards.
    Rafael Monge.
    SAP Business One development consultant.

  • Need config steps to use LM80 transaction to capture serial numbers

    Hi,
    Our shipping process is:
    1. Create delivery (This automatically creates a TO)
    2. Confirm TO
    3. PGI
    If the material is serialized, capturing the serial numbers via VL02N > Extras and then do PGI.
    But due to limitation of scanning only 19 serial numbers at a time in VL02N transaction, have to keep scrolling manually to scan more than 19 serial numbers, we want to use LM80 transaction  to capture serial numbers.
    I need step by step configuration changes and processing steps to use LM80 transaction. As a note, we do scan serial numbers in to system as our business requires scanning 100 serial numbers at times.
    Thanks in advance.
    -Sri

    Hello Alexander,
    Firstly, considering the first and last serial numbers and filling in the rest is good. But the challenges will be as follows:
    1. What happens if the difference between the first and last is too huge? The user will see a huge list of numbers.
    2. What if some in-between serial numbers are consumed already?
    One probable solution can be:
    1. The system suggests the unconsumed serial numbers for picking based on the actual quantity that has to be picked.
    2. The user can either choose these serial numbers or modify the list with scanning based on actual picks.
    The solutions can be many based on the actual way the materials are organized in  the warehouse.
    Regards,
    Dilip
    http://www.indience.com (Enterprise Mobile Company)

  • Change a Serial Number via DI API

    Hi All,
    We have captured a bunch of serial numbers and some of them are wrong. The client has a lot of items and we want to use an excel spreadsheet to update the item numbers that was captured incorrectly. In other words we want to import the correct serial numbers via the DI API. You can change the serial numbers in SBO via Inventory > Item Management > Serial Numbers > Serial Number Management. Enter your item that's got serial numbers in it, click OK and you can modify the Serial Number.
    I have searched the forum and found this post that seems to say that it is not possible. Anything new on this?
    Is there a "standalone" SerialNumbers - Object in DI?
    Thanks in advance,
    Adele

    Adele,
    Looking at the SerialNumbers Object for the 2007A DI API, there does not seem to be an Update method available, only "Add" and "SetCurrentLine" ... so I would say that there is currently no change.
    Eddy

  • SQL query to find all suites that are associated with automation

    I trying to incorporate CodeUI tests into a Release Mangement deployment template ... As a developer, I want to be able to specify a sub-tree of a test plan & only execute those test suites that are associated with automation.  Is there a way to
    extract all automated workitems and associated them with their respective test suites?
    Any assistance would be greatly appreciated!

    John,
    I've partially resolved the issue of executing a sub-set of suites with the following powershell implementation:
    1. Extract "potential" suite paths from a XML configuration file:
    <?xml version="1.0"?>
    <Configurations>
    <Properties>
    <Property key="DEFAULT" value="SuitePaths" />
    <Property key="DatabaseServer" value="MYDBSERVER" />
    <Property key="DatabaseInstance" value="Default" />
    <Property key="DatabaseName" value="TFS_DefaultCollection" />
    <Property key="ConfigurationName" value="US - Windows 7 and IE 10" />
    </Properties>
    <Notifications>
    <Notification key="0" value="[email protected]" />
    </Notifications>
    <SuitePaths>
    <SuitePath key="0" value="MyProject\WebProduct\Student\Features\Login" />
    <SuitePath key="1" value="MyProject\WebProduct\Student\Features\Logout" />
    </SuitePaths>
    <AreaPaths>
    <AreaPath key="0" value="MyProject\WebProduct\Student\Features\Login" />
    </AreaPaths>
    </Configurations>
    2. Extract record set of suites from TFS via SQL query:
    # FUNCTION: Retrieve-SuitePaths
    # Parameters:
    # (1.) LogFile -- Name of log file (e.g., C:\Temp or C:\Temp\DEPLOY_DatabaseServer_WebCMS2_DF06_20131031.6.log)
    # (2.) Connection -- Database connection
    # (3.) Paths -- Hash table of suite paths
    Function Retrieve-SuitePaths
    param
    [Parameter(Mandatory=$True)][String]$LogFile,
    [Parameter(Mandatory=$True)]$Connection,
    [Parameter(Mandatory=$True)]$Paths
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    Write-Output "Retrieve suite(s): " | Out-File -FilePath $LogFile -Append
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    $SuitePaths = "("
    $Counter = 0
    foreach ($Key in $Paths.Keys)
    if ($Counter -gt 0)
    $SuitePaths = $SuitePaths + ", "
    $SuitePaths = $SuitePaths + "'" + $Paths.Get_Item($Key) + "'"
    $Counter += 1
    $SuitePaths = $SuitePaths + ")"
    # --DEBUG ONLY--> Write-Output "Paths: $SuitePaths" | Out-File -FilePath $LogFile -Append
    $Command = New-Object System.Data.SqlClient.SqlCommand
    $SQLStatement = "
    WITH
    cte_SuiteChildren
    AS
    -- Anchor definition to pull all certify modes
    SELECT
    S.[SuiteId],
    S.[ProjectId],
    PJ.ProjectName,
    S.[PlanId],
    P.[Name] AS PlanName,
    S.[ParentSuiteId],
    S.[SuitePath],
    CONVERT(NVARCHAR(256), NULL) AS ParentTitle,
    S.[Title],
    0 AS RecurseLevel
    FROM
    [dbo].[tbl_Suite] AS S
    INNER JOIN [dbo].[tbl_Plan] AS P ON S.PlanID = P.PlanID
    INNER JOIN [dbo].[tbl_Project] AS PJ ON S.ProjectID = PJ.ProjectID
    WHERE
    S.ParentSuiteID = 0
    UNION ALL
    -- Recursive member to pull details of certify sessions
    SELECT
    S.[SuiteId],
    S.[ProjectId],
    PJ.ProjectName,
    S.[PlanId],
    P.[Name] AS PlanName,
    S.[ParentSuiteId],
    S.[SuitePath],
    PS.[Title] AS ParentTitle,
    S.[Title],
    SC.[RecurseLevel] + 1 AS RecurseLevel
    FROM
    [dbo].[tbl_Suite] AS S
    INNER JOIN cte_SuiteChildren AS SC on SC.SuiteID = S.ParentSuiteID
    INNER JOIN [dbo].[tbl_Suite] AS PS ON SC.SuiteId = PS.SuiteId
    INNER JOIN [dbo].[tbl_Plan] AS P ON S.PlanID = P.PlanID
    INNER JOIN [dbo].[tbl_Project] AS PJ ON S.ProjectID = PJ.ProjectID
    cte_SuiteLevel_0
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[ProjectName] + '\' + SC.[PlanName] AS Path,
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 0
    cte_SuiteLevel_1
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 1
    cte_SuiteLevel_2
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 2
    cte_SuiteLevel_3
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 3
    cte_SuiteLevel_4
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 4
    cte_SuiteLevel_5
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 5
    cte_SuiteLevel_6
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 6
    cte_SuiteLevel_7
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 7
    cte_SuiteLevel_8
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 8
    cte_SuiteLevel_9
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 9
    cte_SuiteLevel_10
    AS
    SELECT
    SC.[ProjectId],
    SC.[PlanId],
    SC.[ParentSuiteId],
    SC.[SuiteId],
    SC.[ProjectName],
    SC.[PlanName],
    SC.[Title],
    SC.[RecurseLevel]
    FROM
    cte_SuiteChildren AS SC
    WHERE
    SC.[RecurseLevel] = 10
    cte_Suites
    AS
    SELECT
    SL0.[ProjectId],
    SL0.[PlanId],
    CASE
    WHEN SL2.ParentSuiteId IS NULL
    THEN SL1.ParentSuiteId
    ELSE CASE
    WHEN SL3.ParentSuiteId IS NULL
    THEN SL2.ParentSuiteId
    ELSE CASE
    WHEN SL4.ParentSuiteId IS NULL
    THEN SL3.ParentSuiteId
    ELSE CASE
    WHEN SL5.ParentSuiteId IS NULL
    THEN SL4.ParentSuiteId
    ELSE CASE
    WHEN SL6.ParentSuiteId IS NULL
    THEN SL5.ParentSuiteId
    ELSE CASE
    WHEN SL7.ParentSuiteId IS NULL
    THEN SL6.ParentSuiteId
    ELSE CASE
    WHEN SL8.ParentSuiteId IS NULL
    THEN SL7.ParentSuiteId
    ELSE CASE
    WHEN SL9.ParentSuiteId IS NULL
    THEN SL8.ParentSuiteId
    ELSE CASE
    WHEN SL10.ParentSuiteId IS NULL
    THEN SL9.ParentSuiteId
    ELSE SL10.ParentSuiteId
    END
    END
    END
    END
    END
    END
    END
    END
    END AS [ParentSuiteId],
    CASE
    WHEN SL2.SuiteId IS NULL
    THEN SL1.SuiteId
    ELSE CASE
    WHEN SL3.SuiteId IS NULL
    THEN SL2.SuiteId
    ELSE CASE
    WHEN SL4.SuiteId IS NULL
    THEN SL3.SuiteId
    ELSE CASE
    WHEN SL5.SuiteId IS NULL
    THEN SL4.SuiteId
    ELSE CASE
    WHEN SL6.SuiteId IS NULL
    THEN SL5.SuiteId
    ELSE CASE
    WHEN SL7.SuiteId IS NULL
    THEN SL6.SuiteId
    ELSE CASE
    WHEN SL8.SuiteId IS NULL
    THEN SL7.SuiteId
    ELSE CASE
    WHEN SL9.SuiteId IS NULL
    THEN SL8.SuiteId
    ELSE CASE
    WHEN SL10.SuiteId IS NULL
    THEN SL9.SuiteId
    ELSE SL10.SuiteId
    END
    END
    END
    END
    END
    END
    END
    END
    END AS [SuiteId],
    SL0.ProjectName,
    SL0.PlanName,
    --SL0.Path,
    --SL1.[Title],
    CASE
    WHEN SL2.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title
    ELSE CASE
    WHEN SL3.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title + '\' + SL2.Title
    ELSE CASE
    WHEN SL4.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title + '\' + SL2.Title + '\' + SL3.Title
    ELSE CASE
    WHEN SL5.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title + '\' + SL2.Title + '\' + SL3.Title + '\' + SL4.Title
    ELSE CASE
    WHEN SL6.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title + '\' + SL2.Title + '\' + SL3.Title + '\' + SL4.Title + '\' + SL5.Title
    ELSE CASE
    WHEN SL7.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title + '\' + SL2.Title + '\' + SL3.Title + '\' + SL4.Title + '\' + SL5.Title + '\' + SL6.Title
    ELSE CASE
    WHEN SL8.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title + '\' + SL2.Title + '\' + SL3.Title + '\' + SL4.Title + '\' + SL5.Title + '\' + SL6.Title + '\' + SL7.Title
    ELSE CASE
    WHEN SL9.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title + '\' + SL2.Title + '\' + SL3.Title + '\' + SL4.Title + '\' + SL5.Title + '\' + SL6.Title + '\' + SL7.Title + '\' + SL8.Title
    ELSE CASE
    WHEN SL10.Title IS NULL
    THEN SL0.Path + '\' + SL1.Title + '\' + SL2.Title + '\' + SL3.Title + '\' + SL4.Title + '\' + SL5.Title + '\' + SL6.Title + '\' + SL7.Title + '\' + SL8.Title + '\' + SL9.Title
    ELSE SL0.Path + '\' + SL1.Title + '\' + SL2.Title + '\' + SL3.Title + '\' + SL4.Title + '\' + SL5.Title + '\' + SL6.Title + '\' + SL7.Title + '\' + SL8.Title + '\' + SL9.Title + '\' + SL10.Title
    END
    END
    END
    END
    END
    END
    END
    END
    END AS Path,
    CASE
    WHEN SL2.RecurseLevel IS NULL
    THEN SL1.RecurseLevel
    ELSE CASE
    WHEN SL3.RecurseLevel IS NULL
    THEN SL2.RecurseLevel
    ELSE CASE
    WHEN SL4.RecurseLevel IS NULL
    THEN SL3.RecurseLevel
    ELSE CASE
    WHEN SL5.RecurseLevel IS NULL
    THEN SL4.RecurseLevel
    ELSE CASE
    WHEN SL6.RecurseLevel IS NULL
    THEN SL5.RecurseLevel
    ELSE CASE
    WHEN SL7.RecurseLevel IS NULL
    THEN SL6.RecurseLevel
    ELSE CASE
    WHEN SL8.RecurseLevel IS NULL
    THEN SL7.RecurseLevel
    ELSE CASE
    WHEN SL9.RecurseLevel IS NULL
    THEN SL8.RecurseLevel
    ELSE CASE
    WHEN SL10.RecurseLevel IS NULL
    THEN SL9.RecurseLevel
    ELSE SL10.RecurseLevel
    END
    END
    END
    END
    END
    END
    END
    END
    END AS RecurseLevel
    FROM
    cte_SuiteLevel_0 AS SL0
    LEFT OUTER JOIN cte_SuiteLevel_1 AS SL1 ON SL1.ParentSuiteId = SL0.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_2 AS SL2 ON SL2.ParentSuiteId = SL1.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_3 AS SL3 ON SL3.ParentSuiteId = SL2.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_4 AS SL4 ON SL4.ParentSuiteId = SL3.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_5 AS SL5 ON SL5.ParentSuiteId = SL4.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_6 AS SL6 ON SL6.ParentSuiteId = SL5.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_7 AS SL7 ON SL7.ParentSuiteId = SL6.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_8 AS SL8 ON SL8.ParentSuiteId = SL7.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_9 AS SL9 ON SL9.ParentSuiteId = SL8.SuiteId
    LEFT OUTER JOIN cte_SuiteLevel_10 AS SL10 ON SL10.ParentSuiteId = SL9.SuiteId
    SELECT
    SS.[ProjectId],
    SS.[PlanId],
    SS.[ParentSuiteId],
    SS.[SuiteId],
    SS.[ProjectName],
    SS.[PlanName],
    SS.[Path],
    SS.[RecurseLevel]
    FROM
    SELECT DISTINCT
    S.[ProjectId],
    S.[PlanId],
    S.[ParentSuiteId],
    S.[SuiteId],
    S.[ProjectName],
    S.[PlanName],
    S.[Path],
    S.[RecurseLevel]
    FROM
    cte_Suites AS S
    WHERE
    S.[RecurseLevel] IS NOT NULL
    AND S.[Path] IN $($SuitePaths)
    ) AS SS
    ORDER BY
    SS.[Path]
    $Command.CommandText = $SQLStatement
    $Command.Connection = $Connection
    $Command.CommandTimeout = 240
    $DataAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
    $DataAdapter.SelectCommand = $Command
    $DataSet = New-Object System.Data.DataSet
    $DataAdapter.Fill($DataSet) | Out-Null
    Write-Output "$SQLStatement" | Out-File -FilePath $LogFile -Append
    # --DEBUG ONLY--> $DataSet.Tables[0]
    return $DataSet
    3. Execute every suite in the record set via TCM
    $DataSet = ( Retrieve-SuitePaths -LogFile:$LogFile -Connection:$Connection -Path:$Paths)
    # --DEBUG ONLY--> $DataSet.Tables[0].Rows.Count
    # --DEBUG ONLY--> $DataSet.Tables[0]
    # Determine whether or not any test suites were retrieved from TFS....
    if ( $DataSet.Tables[0].Rows.Count -gt 0 )
    $ListTestRunID = $null
    $SumFailed = 0
    $SumInconclusive = 0
    foreach ($Row in $DataSet.Tables[0].Rows)
    # Set project, plan & suite variables....
    [Int16]$ProjectID = $Row.Item('ProjectId')
    [Int16]$PlanID = $Row.Item('PlanId')
    [Int16]$ParentSuiteID = $Row.Item('ParentSuiteId')
    [Int16]$SuiteID = $Row.Item('SuiteId')
    $ProjectName = $Row.Item('ProjectName')
    $PlanName = $Row.Item('PlanName')
    $Path = $Row.Item('Path')
    $RecurseLevel = $Row.Item('RecurseLevel')
    # Set local build path variable....
    switch -wildcard ($Path)
    "*WebCMS*\Administration\*"
    $CUITBuildPath = $CUITPathUNC + '\WebCMS\Administration'
    "*WebCMS*\Instructor\*"
    $CUITBuildPath = $CUITPathUNC + '\WebCMS\Instructor'
    "*WebCMS*\Student\*"
    $CUITBuildPath = $CUITPathUNC + '\WebCMS\Student'
    "*WebProduct*\Instructor\*"
    $CUITBuildPath = $CUITPathUNC + '\WebProduct\Instructor'
    "*WebProduct*\Student\*"
    $CUITBuildPath = $CUITPathUNC + '\WebProduct\Student'
    default
    $CUITBuildPath = $CUITPathUNC
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    Write-Output 'Test Suite:' | Out-File -FilePath $LogFile -Append
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    Write-Output " ID:" | Out-File -FilePath $LogFile -Append
    Write-Output " Project: $ProjectID" | Out-File -FilePath $LogFile -Append
    Write-Output " Plan: $PlanID" | Out-File -FilePath $LogFile -Append
    Write-Output " Parent Suite: $ParentSuiteID" | Out-File -FilePath $LogFile -Append
    Write-Output " Suite: $SuiteID" | Out-File -FilePath $LogFile -Append
    Write-Output " Config: $ConfigurationID" | Out-File -FilePath $LogFile -Append
    Write-Output " Name:" | Out-File -FilePath $LogFile -Append
    Write-Output " Project: $ProjectName" | Out-File -FilePath $LogFile -Append
    Write-Output " Plan: $PlanName" | Out-File -FilePath $LogFile -Append
    Write-Output " Config: $ConfigurationName" | Out-File -FilePath $LogFile -Append
    Write-Output " Path:" | Out-File -FilePath $LogFile -Append
    Write-Output " Suite: $Path" | Out-File -FilePath $LogFile -Append
    Write-Output " Build: $CUITBuildPath" | Out-File -FilePath $LogFile -Append
    # --DEBUG ONLY--> Write-Output " Recursion: $RecurseLevel" | Out-File -FilePath $LogFile -Append
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    # Set TCM arguements....
    $ArguementPlanID = "/planid:$PlanID"
    $ArguementTitle = "/title:$Title - $Path (SuiteID: $SuiteID)"
    $ArguementSuiteID = "/suiteid:$SuiteID"
    $ArguementConfigurationID = "/configid:$ConfigurationID"
    $ArguementTFSCollection = "/collection:$TFSCollection"
    $ArguementTeamProject = "/teamproject:$TFSTeamProject"
    if(![string]::IsNullOrEmpty($CUITBuildPath))
    $ArguementBuildDirectory = "/builddir:$CUITBuildPath"
    $ArguementBuild = ""
    $ArguementBuildDefinition = ""
    else
    $ArguementBuildDirectory = ""
    $ArguementBuild = "/build:$TFSBuild"
    $ArguementBuildDefinition = "/builddefinition:$BuildDefinition"
    $ArguementTestEnvironment = "/testenvironment:$WebServer"
    $ArguementSettingsName = ""
    if(![string]::IsNullOrEmpty($SettingsName))
    $ArguementSettingsName = "/settingsname:$SettingsName"
    # Create test run....
    Write-Host "$TCMEXE 'run' '/create' $ArguementTitle $ArguementPlanID $ArguementSuiteID $ArguementConfigurationID $ArguementTFSCollection $ArguementTeamProject $ArguementBuild $ArguementBuildDefinition $ArguementBuildDirectory $ArguementTestEnvironment $ArguementSettingsName"
    Write-Output " $TCMEXE 'run' '/create' $ArguementTitle $ArguementPlanID $ArguementSuiteID $ArguementConfigurationID $ArguementTFSCollection $ArguementTeamProject $ArguementBuild $ArguementBuildDefinition $ArguementBuildDirectory $ArguementTestEnvironment $ArguementSettingsName" | Out-File -FilePath $LogFile -Append
    try
    $TestRunID = & $TCMEXE 'run' '/create' $ArguementTitle $ArguementPlanID $ArguementSuiteID $ArguementConfigurationID $ArguementTeamProject $ArguementTFSCollection $ArguementBuild $ArguementBuildDefinition $ArguementBuildDirectory $ArguementTestEnvironment $ArguementSettingsName
    catch
    $ExitMessage = $_Exception.Message
    # --DEBUG ONLY--> Write-Output "TestRunID: $TestRunID" | Out-File -FilePath $LogFile -Append
    if ($TestRunID -match '.+\:\s(?<TestRunID>\d+)\.')
    # The test run ID is identified as a property in the match collection so we can access it directly by using the group name from the regular expression (i.e. TestRunID).
    $TestRunID = $matches.TestRunID
    $ArguementID = "/id:$TestRunID"
    $TestRunResultsFile = $TempDirectory + "\TestRunResults$TestRunID.trx"
    $ArguementQueryText = "/querytext:SELECT * FROM TestRun WHERE TestRunID=$TestRunID"
    $ArguementResultsFile = "/resultsfile:""$TestRunResultsFile"""
    Write-Host " Waiting for test run to complete ..."
    Write-Host $TCMEXE 'run' '/list' $ArguementTeamProject $ArguementTFSCollection $ArguementQueryText
    Write-Output " $TCMEXE 'run' '/list' $ArguementTeamProject $ArguementTFSCollection $ArguementQueryText" | Out-File -FilePath $LogFile -Append
    $WaitingForTestRunCompletion = $true
    $WaitCount= 0
    while ($WaitingForTestRunCompletion)
    $WaitCount = $WaitCount + 1
    Write-Output " Waiting ($WaitCount)...." | Out-File -FilePath $LogFile -Append
    Start-Sleep -s $TestRunWaitDelay
    $TestRunStatus = & $TCMEXE 'run' '/list' $ArguementTeamProject $ArguementTFSCollection $ArguementQueryText
    $TestRunStatus
    if ($TestRunStatus.Count -lt 3 -or ($TestRunStatus.Count -gt 2 -and $TestRunStatus.GetValue(2) -match '.+(?<DateCompleted>\d+[/]\d+[/]\d+)'))
    $WaitingForTestRunCompletion = $false
    Write-Host "Evaluating test run $TestRunID results..."
    # Take small pause(s) since the results might not be published yet....
    Start-Sleep -s $TestRunWaitDelay
    # Export results....
    Write-Host $TCMEXE 'run' '/export' $ArguementID $ArguementTeamProject $ArguementTFSCollection $ArguementResultsFile
    Write-Output " $TCMEXE 'run' '/export' $ArguementID $ArguementTeamProject $ArguementTFSCollection $ArguementResultsFile" | Out-File -FilePath $LogFile -Append
    $WaitingForTestRunExport = $true
    $WaitCount= 0
    while ($WaitingForTestRunExport -and $WaitCount -lt 5)
    $WaitCount = $WaitCount + 1
    Write-Output " Waiting ($WaitCount)...." | Out-File -FilePath $LogFile -Append
    $ExportResult = & $TCMEXE 'run' '/export' $ArguementID $ArguementResultsFile $ArguementTFSCollection $ArguementTeamProject
    if ([System.IO.File]::Exists($TestRunResultsFile))
    $WaitingForTestRunExport = $false
    if ([System.IO.File]::Exists($TestRunResultsFile))
    # Load the XML document contents.
    [xml]$TestResultsXML = Get-Content "$TestRunResultsFile"
    # Extract the results of the test run.
    $TotalTests = $TestResultsXML.TestRun.ResultSummary.Counters.total
    $PassedTests = $TestResultsXML.TestRun.ResultSummary.Counters.passed
    $FailedTests = $TestResultsXML.TestRun.ResultSummary.Counters.failed
    $InconclusiveTests = $TestResultsXML.TestRun.ResultSummary.Counters.inconclusive
    # Output the results of the test run.
    Write-Host "========== Test: $TotalTests tests ran, $PassedTests succeeded, $FailedTests failed, $InconclusiveTests inconclusive =========="
    Write-Output "--------------------------------------------------------------------------------" | Out-File -FilePath $LogFile -Append
    Write-Output "Summary:" | Out-File -FilePath $LogFile -Append
    Write-Output "--------------------------------------------------------------------------------" | Out-File -FilePath $LogFile -Append
    Write-Output " Total: $TotalTests" | Out-File -FilePath $LogFile -Append
    Write-Output " Passed: $PassedTests" | Out-File -FilePath $LogFile -Append
    Write-Output " Failed: $FailedTests" | Out-File -FilePath $LogFile -Append
    Write-Output " Inconclusive: $InconclusiveTests" | Out-File -FilePath $LogFile -Append
    $SumFailed += $FailedTests
    $SumInconclusive += $InconclusiveTests
    # Remove the test run results file.
    [System.IO.File]::Delete($TestRunResultsFile) | Out-Null
    # Add "current" TestRunID to the list of TestRunID(s)....
    if ($ListTestRunID -ne $null)
    $ListTestRunID = $ListTestRunID + ', '
    $ListTestRunID = $ListTestRunID + $TestRunID
    # Next test suite....
    4. Extract record set of test runs  from TFS via SQL query:
    # FUNCTION: Retrieve-TestRuns
    # Parameters:
    # (1.) LogFile -- Name of log file (e.g., C:\Temp or C:\Temp\DEPLOY_DatabaseServer_WebCMS2_DF06_20131031.6.log)
    # (2.) Connection -- Database connection
    # (3.) ListTestRunID -- List of test run identifiers
    Function Retrieve-TestRuns
    param
    [Parameter(Mandatory=$True)][String]$LogFile,
    [Parameter(Mandatory=$True)]$Connection,
    [Parameter(Mandatory=$True)][String]$ListTestRunID
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    Write-Output "Retrieve test run(s): " | Out-File -FilePath $LogFile -Append
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    $TestRuns = '(' + $ListTestRunID + ')'
    $Command = New-Object System.Data.SqlClient.SqlCommand
    $SQLStatement = "
    WITH
    cte_State
    AS
    SELECT 0 AS [StateID], 'Unspecified' AS [StateName]
    UNION ALL
    SELECT 1 AS [OutcomeId], 'To Be Determined (1)' AS [StateName]
    UNION ALL
    SELECT 2 AS [StateID], 'In Progress' AS [StateName]
    UNION ALL
    SELECT 3 AS [StateID], 'Completed' AS [StateName]
    UNION ALL
    SELECT 4 AS [StateID], 'Aborted' AS [StateName]
    UNION ALL
    SELECT 5 AS [OutcomeId], 'To Be Determined (5)' AS [StateName]
    UNION ALL
    SELECT 6 AS [StateID], 'Needs Investigation' AS [StateName]
    SELECT
    TR.[ProjectId] AS [Project Id],
    P.[ProjectName],
    TR.[TestPlanId] AS [Plan Id],
    TP.Name AS [TestPlanName],
    TR.[TestRunId] AS [Run Id],
    TR.[Title],
    S.[StateID] AS [State Id],
    S.[StateName] AS [State],
    TR.[StartDate] AS [Date Started],
    TR.[CompleteDate] AS [Date Completed],
    DATEDIFF(SECOND, TR.[StartDate], TR.[CompleteDate]) AS Duration,
    TR.[Type],
    TR.[IsAutomated],
    TR.[TotalTests] AS [Total],
    TR.[PassedTests] AS [Passed],
    TR.[IncompleteTests] AS [Incomplete],
    TR.[UnanalyzedTests] AS [Unanalyzed],
    TR.[NotApplicableTests] AS [Not Applicable]
    FROM
    [Tfs_DefaultCollection].[dbo].[tbl_TestRun] AS TR
    INNER JOIN [Tfs_DefaultCollection].[dbo].[tbl_Project] AS P ON TR.ProjectId = P.ProjectId
    INNER JOIN [Tfs_DefaultCollection].[dbo].[tbl_Plan] AS TP ON TR.TestPlanId = TP.PlanId
    INNER JOIN cte_State AS S ON TR.[State] = S.[StateID]
    WHERE
    TR.TestRunId IN $($TestRuns)
    ORDER BY
    TR.[StartDate]
    $Command.CommandText = $SQLStatement
    $Command.Connection = $Connection
    $Command.CommandTimeout = 30
    $DataAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
    $DataAdapter.SelectCommand = $Command
    $DataSet = New-Object System.Data.DataSet
    $DataAdapter.Fill($DataSet) | Out-Null
    Write-Output "$SQLStatement" | Out-File -FilePath $LogFile -Append
    # --DEBUG ONLY--> $DataSet.Tables[0]
    return $DataSet
    5. Extract record set of test results from TFS via SQL query:
    # FUNCTION: Retrieve-TestRunResults
    # Parameters:
    # (1.) LogFile -- Name of log file (e.g., C:\Temp or C:\Temp\DEPLOY_DatabaseServer_WebCMS2_DF06_20131031.6.log)
    # (2.) Connection -- Database connection
    # (3.) ListTestRunID -- List of test run identifiers
    Function Retrieve-TestRunResults
    param
    [Parameter(Mandatory=$True)][String]$LogFile,
    [Parameter(Mandatory=$True)]$Connection,
    [Parameter(Mandatory=$True)][String]$ListTestRunID
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    Write-Output "Retrieve test result(s): " | Out-File -FilePath $LogFile -Append
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    $TestRuns = '(' + $ListTestRunID + ')'
    $Command = New-Object System.Data.SqlClient.SqlCommand
    $SQLStatement = "
    WITH
    cte_Outcome
    AS
    SELECT 0 AS [OutcomeId], 'To Be Determined (0)' AS [OutcomeName]
    UNION ALL
    SELECT 1 AS [OutcomeId], 'In Progress' AS [OutcomeName]
    UNION ALL
    SELECT 2 AS [OutcomeId], 'Passed' AS [OutcomeName]
    UNION ALL
    SELECT 3 AS [OutcomeId], 'Failed' AS [OutcomeName]
    UNION ALL
    SELECT 4 AS [OutcomeId], 'Inconclusive' AS [OutcomeName]
    UNION ALL
    SELECT 5 AS [OutcomeId], 'To Be Determined (5)' AS [OutcomeName]
    UNION ALL
    SELECT 6 AS [OutcomeId], 'Aborted' AS [OutcomeName]
    UNION ALL
    SELECT 7 AS [OutcomeId], 'Blocked' AS [OutcomeName]
    UNION ALL
    SELECT 8 AS [OutcomeId], 'Not Executed' AS [OutcomeName]
    UNION ALL
    SELECT 10 AS [OutcomeId], 'Error' AS [OutcomeName]
    UNION ALL
    SELECT 11 AS [OutcomeId], 'Not Applicable' AS [OutcomeName]
    UNION ALL
    SELECT 12 AS [OutcomeId], 'Paused' AS [OutcomeName]
    UNION ALL
    SELECT 13 AS [OutcomeId], 'To Be Determined (13)' AS [OutcomeName]
    UNION ALL
    SELECT 255 AS [OutcomeId], 'Never Run' AS [OutcomeName]
    cte_State
    AS
    SELECT 0 AS [StateID], 'None' AS [StateName]
    UNION ALL
    SELECT 1 AS [StateID], 'Ready' AS [StateName]
    UNION ALL
    SELECT 2 AS [StateID], 'Completed' AS [StateName]
    UNION ALL
    SELECT 3 AS [StateID], 'Not Ready' AS [StateName]
    UNION ALL
    SELECT 4 AS [StateID], 'In Progress' AS [StateName]
    UNION ALL
    SELECT 5 AS [StateID], 'To Be Determined' AS [StateName]
    SELECT DISTINCT
    TR.[TestRunId] AS [Run Id],
    TR.[TestCaseId] AS [Case Id],
    O.[OutcomeID] AS [Outcome Id],
    O.[OutcomeName] AS [Outcome],
    S.[StateID] AS [State Id],
    S.[StateName] AS [State],
    TR.[TestCaseTitle] AS [Title],
    TR.[AutomatedTestName] AS [Automation Method],
    TR.[DateStarted] AS [Date Started],
    TR.[DateCompleted] AS [Date Completed],
    DATEDIFF(SECOND, TR.[DateStarted], TR.[DateCompleted]) AS Duration,
    TR.[FailureType] AS [Failure Type],
    TR.[ErrorMessage] AS [Error]
    FROM
    [Tfs_DefaultCollection].[dbo].[tbl_TestResult] AS TR
    INNER JOIN cte_Outcome AS O ON TR.Outcome = O.OutcomeID
    INNER JOIN cte_State AS S ON TR.State = S.StateID
    WHERE
    TR.TestRunId IN $($TestRuns)
    ORDER BY
    TR.[TestRunId],
    O.[OutcomeName],
    TR.[TestCaseTitle]
    $Command.CommandText = $SQLStatement
    $Command.Connection = $Connection
    $Command.CommandTimeout = 30
    $DataAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
    $DataAdapter.SelectCommand = $Command
    $DataSet = New-Object System.Data.DataSet
    $DataAdapter.Fill($DataSet) | Out-Null
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    Write-Output "SQL Statement: " | Out-File -FilePath $LogFile -Append
    Write-Output '--------------------------------------------------------------------------------' | Out-File -FilePath $LogFile -Append
    Write-Output "$SQLStatement" | Out-File -FilePath $LogFile -Append
    # --DEBUG ONLY--> $DataSet.Tables[0]
    return $DataSet
    6. Email results to distribution list  
        Currently, I'm simplifying the extraction of suite path ... replacing hardcoded depth with STUFF() & XML PATH
    Carl.

  • Query to join po, pr, receipts, serial numbers

    Dear All
    I need to make report for po, pr, receipts and serial numbers. I have the two queries seperate but i have to join the both in single query.
    can any one have the query kindly post it.
    Regards
    xyz
    Edited by: user11309801 on Jan 28, 2012 4:01 AM

    Use outer join:
    select  code,
            requester
      from  test1,
            test2
      where serial between startno(+) and endno(+)
      order by code
    C REQUESTER
    A TATA
    B TATA
    C TOTO
    D
    E
    SQL> SY.

  • How to insert serial numbers in the creation of a delivery via VL01N

    Hello everybody,
    In the creation of an outbound delivery via VL01N I have to copy the serial number from a specific inbound delivery. I can get these serial numbers but I do not know where or how I can insert these serial numbers.
    I have to insert them just after the user press enter in the first screen of VL01N (before the delivery number is created) I cannot use a bapi like BAPI_OUTB_DELIVERY_CHANGE because the delivery is not created yet.
    Could anybody tell me how to do it? Any BAdI/Exit I can use? and which internal table I shoud update?
    Thanks a lot.

    But this is impossible! Believe me! When I open Creative Cloud.app, the window which pops out says :
    ===========================================
    APPLICATIONS INSTALLEES (= Installed applications)
    Indesign CC (2014) ----- A jour (= up-to-date)
    Acrobat XI pro ----- A jour (= up-to-date)
    TROUVER DE NOUVELLES APPS (= Find new apps)
    Photoshop CC (2014) ----- Installer (Install)
    etc., etc.
    ===========================================
    In the second part of the window, you have already installed apps, as Photoshop, which have not been updated as well as apps I have never installed, as Scout CC.
    So it is impossible to install Indesign anew.
    When I click on the small gear, a small window opens up, and I can check that in Preferences/Apps that the "Langue de l'app", that is the "Language of the app" is "English plus hebrew (some hebrew characters)
    ", since i made this choice yesterday, as you told me.
    And nevertheless, the Creative Cloud.app does not want to download any new Indesign application.
    It is not possible to ask the people at Adobe who have designed CC.app?
    Thank you,
    André Bellaïche

  • How to Query serial numbers on VXI smip modules.

    I'm trying to write a program in C# that will query the VXI SMIP Switch Modules for their serial numbers.  Right now I am able to view all the serial numbers through the soft front panel provided with the drivers but I need to automate this process and extract the serial numbers for further processing so I need to access the modules directly and read the data.
    My current  Setup:
    [Computer with PCI-MXI-2 Board] ------> [ Racal Chassis  with  "SM1000E double wide Carrier" that can hold 6 VXI SMIP switch module plugin cards]
    I'm able to see all resources in NI MAX.
    The VXI resource is shown in NI MAX as : VXI0::26::INSTR
    The VXI SM1000E Carrier that holds the 6 plugin module has logical address 26
    and there are 6 modules in there carrier that is 0 based, module 1 is 0, module 2, is 1, module 3, is 2 and so on...
    To my understanding, Visual Studio can automatically create wrapper code using the "Driver Wrapper Wizard" included with the T&M ToolKit.  And by doing this I was able to access some of the functions of the drivers associated with this module.
    I'm trying to use the vtvmSmip_QuerySmip function, which will return the NonVol data for up to six plug-in cards at once according to the documentation in the driver header file.  The definition of the SMiP NonVol structure can be found in the vtvmSmip.h file. But I'm still unsure how to use it.
    Using Visual Studio 2003, the function is available but it requires some arguments.
    Below is the wrapper code generated.
    [code]
    private void button1_Click(object sender, System.EventArgs e)
     // This code creates and initializes an instance of the VXIplug&play wrapper class
     // TODO:  Insert your appropriate values for address, idQuery etc.
     Agilent.TMFramework.InstrumentDriverInterop.Vxipn​pWrappers.VtvmSmip myVtvmSmip;
     myVtvmSmip = new Agilent.TMFramework.InstrumentDriverInterop.Vxipnp​Wrappers.VtvmSmip("GPIB0::7::INSTR", true, true);
     // TODO:  Add your code here.  For example:
     // myVtvmSmip.Reset();
    [code end]
    I was wondering if, I want to use myvtvmSmip.QuerySmip();  What should I pass in as the arguments?  This fuction suppose to return all 6 modules information. not sure how...
    Its definition is as follows:
    void VtvmSmip.QuerySmip(int smipStruct)
    "smipStruct points to the locaton where the data is to be sotred.  The Structure is of type vtvmSmip_SMIP_TYPE.  Look in vtSmipDefs.h for the definition of vtvmSmip_SMIP_TYPE.  Note:  The Plug&Play spec prohibits exporting data structures, so the structure is not exported."
    s
    I get and exception when I use this as:
    myVtvmSmip.QuerySmip(1);
    didnt work gave me exception..
    Another fuction I coulduse was this one.
    myVtvmSmip.ReadNonvol();
    I guess this returns 1 module at a time.
    Definition:
    voidVtvmSmip.ReadNonvol(short smodNmbr, System.Text.StringBuilder nvData)
    I suppose smodnmbr responds to each module, 0, 1, 2, 3, 4, and 5.
    I hope this isnt too much information.. I just want to be able to read the serial numbers of of these switch modules so I can process them.  If anyone can help, that would be great.  Thanks.
    Chan

    Hi Matt,
    Thanks for your replay. Right now im trying to query the VXI Tech SMP1200 double slot carrier that holds 6 SMP5004 modules.  But I have other SMP switches as well after I figure this one out, I belive if I can do this one, they should be the same for the other switches.
    SMP1200 Product Link:
    http://www.vxitech.com/ProductDescription.aspx?PID​=218
    SMP5004 Product Link:
    http://www.vxitech.com/ProductDescription.aspx?PID​=242
    I belive I have the drivers from the manufacturer.  When I try to implement the code below, I get an exception error.
    The logical address of the SMP1200 Carrier is 26. And it has a resource name of "VXI0::26::INSTR" as should in NIMAX.
    The SMP1200 holds 6 switch modules and I think its zero based ( Module 1 is 0, Module 2 is 1, Module 3 is 2 etc..up to 5)
    reading through the vtSmipDefs.h file included with the drivers, It says QuerySmip() returns information about 6 modules at once.
    ReadNonvol() reads one module at a time I belive.  Not sure how this works because using these functions, they dont return a value.  I don't know If I have to somehow read it back.
    [CODE]
    private void button1_Click(object sender, System.EventArgs e)
     // This code creates and initializes an instance of the VXIplug&play wrapper class
     // TODO:  Insert your appropriate values for address, idQuery etc.
     Agilent.TMFramework.InstrumentDriverInterop.Vxipn​pWrappers.VtvmSmip myVtvmSmip;
     myVtvmSmip = new Agilent.TMFramework.InstrumentDriverInterop.Vxipnp​Wrappers.VtvmSmip("VXI0::26::INSTR", true, true);
     // TODO:  Add your code here.  For example:
     // myVtvmSmip.Reset();
    myVtvmSmip.QuerySmip(1);
    [CODE}
    The code above is automatically generated using the built in Agilent T&M Toolkit driver wrapper wizard in the menu in Visual Studio 2003.  using this code, the intellisense menu does appear to show all the class members functions from the driver.
    When I run the program, I get an exception error.
    Ill post the exact data as soon as im back at work.
    I can also send you a link to the drivers and the help files that have some information about it. 
    Im kinda a newbie here with programming in C# and also VXI/MXI.  This is just part of my whole application im writing.  So far I've been able to query all the instruments(meters, scopes, etc) through the GPIB using IDN query so far.  Just the VXI left and its killing me.  Appreciate you help.  Look forward to your reply.
    Thanks Chan

  • How do i get a output in CSV of a SQL query executed via SQL Command prompt

    Hi All,
    I have a question with reference to SQL command prompt. I have a sql query which runs properly and gives proper execution in SQL Management console in GUI.
    This report is used to pull the free disk space report of our servers
    As i want to schedule it as a report so i want to script it to run via SQL command prompt. I made the script and it works fine if i enter it in SQL command prompt. When i try to extract the output to a CSV File it fails. Below is the details of the command
    i am using to query to pull the data. Can anyone help me in getting the output of this query in SQL command prompt.
    sqlcmd -W -s , -S Servers FQDN
    use operationsmanager
    Go
    Query:"select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "C:\DataSqlCmd.csv"
    Go
    When i enter the command without the quotes when the query is starting and ending and also without the output command (-s "," -o "C:\DataSqlCmd.csv") it is working and shows the output in the command prompt. Below is the screen shot for
    your reference.
    Due to security reasons i have to erase the server names:
    But when i add the line to extract the output ( -s "," -o "C:\DataSqlCmd.csv") It gives me this error:
    The exact command would be:
    sqlcmd -W -s , -S CINMLVSCOM01.e2klab.ge.com
    use operationsmanager
    Go
    "select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "C:\DataSqlCmd.csv" -h-1
    Go
    saying the syntax is not correct or some thing as per the below screenshot.
    Can any one please help. Below is just the query whi i use to get the output in SQL management studio.
    Can any one make a command for the below quer so i can directly execute and test for getting the output.
    select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled
    Gautam.75801

    Can you try the below query?
    select Path, InstanceName, SampleValue
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < 20 and CounterName like '% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled
    -- replace the below query part in the below SQLCMD C:\>SQLCMD -S SERVERNAME -E -d operationsmanager -Q "select * from sys.databases ds with (nolock) where name='master'" -s "," -o "F:\PowerSQL\MyData.csv" -h -1
    SQLCMD -S SERVERNAME -E -d OperationsManager -Q "select Path, InstanceName, SampleValue
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "c:\MyData.csv" -h -1
    Refer for the other ways 
    http://dba.stackexchange.com/questions/23566/writing-select-result-to-a-csv-file
    --Prashanth

  • Can HTML-based reports be built in BLS via an SQL Query and XSLT?

    Hello xMII experts,
    I have already built a report in xMII which uses XSLT to provide group/sum totals in a web browser. However in a new project, the report must run at certain times and possibly when certain signals become true in the process.
    It appears that BLS is a good choice to achieve this and my proposed Transaction was:
    1. SQL Query Action(uses the same QueryTemplate as in xMII)
    2. XSLTransform Action on the resulting XML resultset (The .xsl file contains HTML which is the original used in xMII to produce the report there)
    3. HTML Loader action with the resulting output of the transformation
    I have now got some output in the resulting HTML file - however it omits all XSLT code - and I am left with an empty HTML shell but for a few images.
    This indicates that perhaps no SQL data was ever returned.
    I have therefore two questions:
    1. How can I check if the SQL returned data?
    2. Is it possible to deliver data to a HTML file directly after an XSLTransformation.
    Looking forward to your responses
    Best Regards
    Robert Sales

    Thank you for the replies.
    I am a little closer the result I need - however I think I need to explain what I had and what I need a little better.
    Before BLS
    1 xMII report page (.irpt extension) with two iCalendar applets (start/end date) and a set of buttons (1 for each report)
    Upon clicking on a button the two dates are passed into an .irpt file, and via a servlet an SQL QueryTemplate and a XSL DisplayTemplate are used to build the report.
    The HTML is embedded in the XSL file - thereby generating the report direct in the web browser.
    - This all works fine
    With BLS
    A transaction which uses a modified SQL QueryTemplate (no date parameters) passing the results to an XML file. This works.
    Now when I click on the button in my xMII screen the .irpt file is called with no Date parameters and the xAcute QueryTemplate called with the XSL DisplayTemplate. The irpt file has <html> and <body> tags with XSL file in the Servlet call providing the tables and data extraction from the XML.
    I have no additional HTML file so I placed the iframe tag inside the XSL file - but it refers to the .irpt file - this doesn't sound right!
    I do get a little output in the web browser but it still omits all XSLT code.
    One more point - The Transaction can be scheduled and run as required - but I need the entire report to created and stored for viewing at a later date. Will a servlet tag running inside an .irpt file achieve this?
    Sorry for the chaotic writing here - but I must leave the office.
    Regards
    Robert Sales

  • SQL Query to print 1-n numbers?

    for(int i =0; i<n i++)
    We can print 1-n numbers on the console by using above loop.
    In the sameway How I can display 1-n numbers on SQL console by using SQL Query..?
    Can any body help me regarding this?>

    SowmyRaj wrote:
    hi justin.... thanks for ur answer.... can u give me ur yahoo or gmail id?Now, i'm really stunned by your so many rapid posted threads and that too you can do yourself if you invested some time and make some R&D work.
    I don't want to hurt your feeling but i think you should invest some time to do this job. Or, you can get plenty of related solution and then you have to customize those to your required solution. Only that will help you to earn knowledge.
    You know one general suggestion -> Try to do the solution by yourself. If you stuck or don't have any clue then post it here - we will post the clue or post your required solution if you stuck.
    We are always there to help you. Don't mind.
    Regards.
    Satyaki De.

  • My photoshop elements and Lightroom serial numbers won't work for my new mac. I bought these softwares via download on my windows laptop but returned that laptop because the quality was not great. I decided to buy a mac and now can't use my serial numbers

    my photoshop elements and Lightroom serial numbers won't work for my new mac. I bought these softwares via download on my windows laptop but returned that laptop because the quality was not great. I decided to buy a mac and now can't use my serial numbers to download the software.

    Moving this discussion to the Downloading, Installing, Setting Up forum.
    Stephylei you will want to download the Mac versions of the installation files.  If you purchased the software from Adobe, and choose the download option at the time of purchase, then the download will be available under your account.  You can find more details at Find a download link on Adobe.com.

Maybe you are looking for

  • Profit center in material master is not in MARC table

    Hi All, We have maintained profit center in Material master costing 1 screen but when I am checking it in MARC table I am not able to see profit center in MARC Table. Please tell me in which table this profit center data will sit. Thanks in advance.

  • Override a Look Up SQL Query

    Is it possible to override the look up SQL query in the Key Look Up Operator? Suppose I want to run the following query select customer, max(revenue) from CUSTOMER group by customer_id and then look up the customer id and get the max revenue from the

  • I need a simple widget to show channels and strenght

    I am looking for a simple widget to help me chart signal strenght, channels used, and interfearance around me (so I can use the best AEBS for me). Any suggestions?

  • The update ios 6.01 killed my iphone 4s. How do I fix this

    I started the update as suggested last night and things were fine and then all of a sudden my the only thing that would come up on my screen is the itunes logo and with the cord. I plugged into my computer and pulled up itunes to get the fix and then

  • Insert or create a button based scrolling Java script

    Goodmorning! Although I don't know yet how to write it, I was wondering if it is possible to create a Javascript (widget) myself for button based scrolling? I've been looking on the internet too, and there I can find many Javascripts. So if anyone co