[Forum FAQ] How to calculate the total count of insert rows within a Foreach Loop Container in SSIS?

Introduction
We need to loop through all the flat files that have the same structure in a folder and import all the data to a single SQL Server table. How can we obtain the total count of the rows inserted to the destination SQL Server table?
Solution
We can use Execute SQL Task or Script Task to aggregate the row count increment for each iteration of the Foreach Loop Container. The following steps are the preparations before we add the Execute SQL Task or Script Task:
Create a String type variable FilePath, two Int32 type variables InsertRowCnt and TotalRowCnt.
Drag a Foreach Loop Container to the Control Flow design surface, set the Enumerator to “Foreach File Enumerator”, specify the source folder and the files extension, and set the “Retrieve file name” option to “Fully qualified”.
On the “Variable Mappings” tab of the container, map the variable FilePath to the collection value.
Drag a Data Flow Task to the container, in the Data Flow Task, add a Flat File Source, a Row Count Transformation, and an OLE DB Destination, and join them. Create a Flat File Connection Manager to connect to one of the flat files, and then configure the
Flat File Source as well as the OLE DB Destination adapter. Set the variable for the Row Count Transformation to “User::InsertRowCnt”.
Open the Property Expressions Editor for the Flat File Connection Manager, and set the expression of “ConnectionString” property to
“@[User::FilePath]”.
(I) Execute SQL Task Method:
In the Control Flow, drag an Execute SQL Task under the Data Flow Task and join them.
Create one or using any one existing OLE DB Connection Manager for the Execute SQL Task, set the “ResultSet” option to “Single row”, and then set the “SQLStatement” property to:
DECLARE @InsertRowCnt INT,
               @TotalRowCnt INT
SET @InsertRowCnt=?
SET @TotalRowCnt=?
SET @TotalRowCnt=@InsertRowCnt+@TotalRowCnt
SELECT TotalRowCnt=@TotalRowCnt
On to parameter 1. 
On the “Result Set” tab of the Execute SQL Task, map result 0 to variable “User::TotalRowCnt”.
(II) Script Task Method:
In the Control Flow, drag a Script Task under the Data Flow Task and join them.
In the Script Task, select variable InsertRowCnt for “ReadOnlyVariables” option, and select variable TotalRowCnt for “ReadWriteVariables”.
Edit the Main method as follows (C#):
public void Main()
// TODO: Add your code here
int InsertRowCnt = Convert.ToInt32(Dts.Variables["User::InsertRowCnt"].Value.ToString()
int TotalRowCnt = Convert.ToInt32(Dts.Variables["User::TotalRowCnt"].Value.ToString());
TotalRowCnt = TotalRowCnt + InsertRowCnt;
Dts.Variables["User::InsertRowCnt"].Value = TotalRowCnt;
Dts.TaskResult = (int)ScriptResults.Success;
          Or (VB)
          Public Sub Main()
        ' Add your code here
        Dim InsertRowCnt As Integer =        
        Convert.ToInt32(Dts.Variables("User::InsertRowCnt").Value.ToString())
        Dim TotalRowCnt As Integer =
        Convert.ToInt32(Dts.Variables("User::TotalRowCnt").Value.ToString())
        TotalRowCnt = TotalRowCnt + InsertRowCnt
        Dts.Variables("User::TotalRowCnt").Value = TotalRowCnt
        Dts.TaskResult = ScriptResults.Success
       End Sub
Applies to
Microsoft SQL Server 2005
Microsoft SQL Server 2008
Microsoft SQL Server 2008 R2
Microsoft SQL Server 2012
Microsoft SQL Server 2014
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

Hi ITBobbyP,
If I understand correctly, you want to load data from multiple sheets in an .xlsx file into a SQL Server table.
If in this scenario, please refer to the following tips:
The Foreach Loop container should be configured as shown below:
Enumerator: Foreach ADO.NET Schema Rowset Enumerator
Connection String: The OLE DB Connection String for the excel file.
Schema: Tables.
In the Variable Mapping, map the variable to Sheet_Name, and change the Index from 0 to 2.
The connection string for Excel Connection Manager is the original one, we needn’t make any change.
Change Table Name or View name to the variable Sheet_Name.
If you want to load data from multiple sheets in multiple .xlsx files into a SQL Server table, please refer to following thread:
http://stackoverflow.com/questions/7411741/how-to-loop-through-excel-files-and-load-them-into-a-database-using-ssis-package
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support

Similar Messages

  • Hi frinds ,how to calculate the  totals in smartforms

    1)how to calculate the  totals in smartforms .

    Hi,
        To calculate totals and sub totals in sap scripts you can use subroutines.
    Say if you have to add the unit price (KOMVD-KBERT) then in the main window whereever tat value is picked write this routine
    /: DEFINE &TOT_PRICE&
    /: PERFORM F_GET_PRICE IN PROGRAM /:USING &KOMVD-KBERT& /:CHANGING &TOT_PRICE& /:ENDPERFORM
    Then write the variable where ever you want it to be printed (mostly it will be in footer window)
    Then create subroutine pool program and you have to write the code.
    FORM F_GET_PRICE tables int_cond structure itcsy
    outt_cond structure itcsy. data : value type kbert.
    statics value1 type kbert.
    Read int_cond table index 1.
    value = int_cond-value.
    value1 = value1 + value.
    Read outt_cond table index 1.
    outt_cond-value = value1.
    Modify outt_cond index 1.
    ENDFORM.
    regards..

  • How can I load a .xlsx File into a SQL Server Table using a Foreach Loop Container in SSIS?

    I know I've REALLY struggled with this before. I just don't understand why this has to be soooooo difficult.
    I can very easily do a straight Data Pump of a .xlsX File into a SQL Server Table using a normal Excel Connection and a normal Excel Source...simply converting Unicode to DT_STR and then using an OLE DB Destination of the SQL Server Table.
    If I want to make the SSIS Package a little more flexible by allowing multiple .xlsX spreadsheets to be pumped in by using a Foreach Loop Container, the whole SSIS Package seems to go to hell in a hand basket. I simply do the following...
    Put the Data Flow Task within the Foreach Loop Container
    Add the Variable Mapping Variable User::FilePath that I defined as a Variable and a string within the FOreach Loop Container
    I change the Excel Connection and its Expression to be ExcelFilePath ==> @[User::FilePath]
    I then try and change the Excel Source and its Data Access Mode to Table Name or view name variable and provide the Variable Name User::FilePath
    And that's when I run into trouble...
    Exception from HRESULT: 0xC02020E8
    Error at Data Flow Task [Excel Source [56]]:SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occured. Error code: 0x80004005.
    Error at Data Flow Task [Excel Source [56]]: Opening a rowset for "...(the EXACT Path and .xlsx File Name)...". Check that the object exists in the database. (And I know it's there!!!)
    I don't understand by adding a Foreach Loop Container to try and make this as efficient as possible has caused such an error unless I'm overlooking something. I have even tried delaying my validations and that doesn't seem to help.
    I have looked hard in Google and even YouTube to try and find a solution for this but for the life of me I cannot seem to find anything on pumping a .xlsX file into SQL Server using a Foreach Loop Container.
    Can ANYONE please help me out here? I'm at the end of my rope trying to get this to work. I think the last time I was in this quandry, trying to pump a .xlsX File into a SQL Server Table using a Foreach Loop Container in SSIS, I actually wrote a C# Script
    to write the contents of the .xlsX File into a .csv File and then Actually used the .csv File to pump the data into a SQL Server Table.
    Thanks for your review and am hoping and praying for a reply and solution.

    Hi ITBobbyP,
    If I understand correctly, you want to load data from multiple sheets in an .xlsx file into a SQL Server table.
    If in this scenario, please refer to the following tips:
    The Foreach Loop container should be configured as shown below:
    Enumerator: Foreach ADO.NET Schema Rowset Enumerator
    Connection String: The OLE DB Connection String for the excel file.
    Schema: Tables.
    In the Variable Mapping, map the variable to Sheet_Name, and change the Index from 0 to 2.
    The connection string for Excel Connection Manager is the original one, we needn’t make any change.
    Change Table Name or View name to the variable Sheet_Name.
    If you want to load data from multiple sheets in multiple .xlsx files into a SQL Server table, please refer to following thread:
    http://stackoverflow.com/questions/7411741/how-to-loop-through-excel-files-and-load-them-into-a-database-using-ssis-package
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to calculate the total from users input in switch?

    I dont know how to hold the input from user. But here is part of my coding :
    System.out.println ("Type 1 for buying Ruler"+
    "\nType 2 for buying Pencil");
    stationaries = console.nextInt();
    switch (stationaries)
    case 1 : System.out.println("Ruler per unit : MYR1");
    System.out.println("How much does you want? : ")
    wantRuler = console.nextInt();
    sum = wantRuler * 1;
    break;
    case 2 : System.out.println("Pencil per unit : MYR2");
    System.out.println("How much does you want? : ")
    wantPencil = console.nextInt();
    sum = wantPencil * 2;
    break;
    How can I calculate the total for both of the stationaries if user wants 5 for ruler and 6 for pencil?

    Note: This thread was originally posted in the [Java Programming|http://forums.sun.com/forum.jspa?forumID=31] forum, but moved to this forum for closer topic alignment.
    Use code tags to post codes -- [code]CODE[/code] will display asCODEOr click the CODE button and paste your code between the {code} tags that appear.

  • How to calculate the total of bytes transferred when I submit a PDF Form in A. Reader

    Hello,
    I need to know some way for calculate the total of bytes transferred when I submit a PDF form using JavaScript, hereby:
    b ******************************************************************
    i var service_url = http://some_webservice/;
    i var send_type = "PDF";
    i var doc = event.target;
    i doc.submitForm( { cURL: service_url, cSubmitAs: send_type } );
    b ******************************************************************
    b The reason:
    I need to indicate the percentage of bytes sent to the server, in real time. Adobe Acrobat shows a progress bar and the transferred quantity in bytes, but Adobe Reader doesn't. Is in this case, when I need to find a way in order to make something similar.
    b Than you for your time.

    You can use SharePoint Designer and calculate the total in xslt view. Refer to the following post for more information
    http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2009/04/24/how-to-total-calculated-columns-in-a-sharepoint-list.aspx
    http://blog.metrostarsystems.com/2012/12/03/jennys-sharepoint-tip-sum-calculated-columns/
    Cheers,

  • How to calculate the total of a calculated column in a list view at the end of the view?

    I have a view with the following columns ProductName, Quantity, Price, Total The total column is a calculated column which is the product of quantity and price. I want to place the sum of the total column by the end of the list view. I can do this with
    the price and quantity but not with the total column. how do I do this?

    You can use SharePoint Designer and calculate the total in xslt view. Refer to the following post for more information
    http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2009/04/24/how-to-total-calculated-columns-in-a-sharepoint-list.aspx
    http://blog.metrostarsystems.com/2012/12/03/jennys-sharepoint-tip-sum-calculated-columns/
    Cheers,

  • How to calculate the total of absences? How to collect data from a specific line of a table?

    Hi,
    Again, I made a nice coloured picture from a screen capture which summarise the improvements that I would like to make in my form,
    Situation:
    For an educational purpose, I made this form   to simplify the way of recording the data and also to develope the independence of the students.
    ( I am doing this on a voluntary basis, working extra hours on my free time but I don't really mind because I am learning a lot of things in the same time)
    After being tested by the teacher, the student has to record the short date, the lines memorised, his grade, number of mistakes, and his attendance.
    I created everything in Word, then converted the file in PDF, then I created all the different fields with Adobe acrobat.
    There is in total 4 sheets, there are all similar except the first one in which there is a box with: date started, date finished, total time spent, absences.
    Below this box there is a table with 16 lines from (A to P) and 7 columns (Days, Date, From.. to.. , Grade, No. lines memorised, No. Errors, Attendance) ( so this table is present on all the sheets)
    Due to the fact that some students need more time than others, and also beacause some text need more time, I estimated a need of 4 sheets at the very most.
    I would like to make the following amelioration and automate the inputting of some of the data because I know that some of the students will certainly forget, so to avoid this scenario I am trying to make this form the easiest possible.
    screen capture of the form:
    screen capture of the form editing, you can see the names of the different fields:
    here is the form (only the first page) : http://cjoint.com/12fe/BBotMMgfYIy_memorisation_sheet_sample.pdf
    In  yellow 00000:
    At present, the students has to input the total of absences manually, is there a way ( script) to automate this by initialising the field next to "Absences" at  " 0 day"   and then everytime that Absent is selected from the COMBO BOX, it add 1 and it is displayed like this:  " 1 day" then " 2 days"  then " 3 days" etc … (so from what I read I have to initialise a counter a the beginning and then for (i...   ) count= count++; something like this...
    Furthermore, I need a solution to overcome the possibility that a second sheet may be needed for the same student; therefore I would need the data from the "attendance column" from the second sheet ( and perhaps the 3rd and 4th aswell) to be added on the "absences field" in the first sheet
    My idea: everytime that the short date is inputted in the first line (next to A) in the "Date" column of one of the 4 sheets then we check the 16 Combo box of the attendance column in this sheet instead to check 16*4=64 fields fot the 4 sheets in one go?
    but I don't know at all how to write it in Javascript. Or perhaps there is a way more easier than that?
    Shall I allocate a value for Absent on the “ export value”?
    In purple
    At present I wrote a simple script which matches the number of lines to the poem selected (Eg.  if I select the poem V.Hugo,  the number "36" will appear next to Number of lines).
    Again I would like the make the life of the students very easy so I would like a script which detects this number “36” on the "From .. to …" column,  as soon it is detected (on the first sheet or 2nd or 3rd or 4th)  check from the same line if "A / Pass" or "B / Pass" have been selected in the "Grade" column ,if yes the short date inputted on this line will be written on the field next to "Date finished" .
    this is a simple example with 36 lines only but somethimes, the students may have to memorise 80 lines and more, this is the reason for having 4 sheets in total.
    So basically I would like to automate the field next to" Date finished:" with a script that collect the short date from the day in which the student has finished his memorisation with "A / Pass" or "B / Pass"
    As for the "Total time spent" George Johnson helped me with a script that calculate the difference betwen date started and date finished (thank you)
    I am sollicting your help, because after trying for hours I was really confused with the different if/else needed. And in top of that, it’s my first experience with Javascript.
    I anticipate your assistance, thanking you in advance.

    I found this for counting the absences, its give you the total that's perfect, but is there a better methode which avoid me to write all the fields name, more simple????
    ( I found the idea here : Re: Total number added automatically  )
    // custom calculation script for field "Total #"
    function CountFields(aFields) {
    var nFields = 0;
    for(i = 0; i < aFields.length; i++) {
    try {
    // count null values, export value of Absence is 0;
    if(this.getField(aFields[i]).value == "0") nFields++;
    } catch(e) {
    if(e['message'] == "this.getField(aFields[i]) has no properties") app.alert("unknown field name: " + aFields[i]);
    else app.alert(e.toString());
    } // end catch
    } // end for aFields
    return nFields;
    // create array of field names to count
    var aNames = new Array("Sheet1AttendanceA","Sheet1AttendanceB","Sheet1AttendanceC","Sheet1AttendanceD","Sh eet1AttendanceE","Sheet1AttendanceF",
    "Sheet1AttendanceG","Sheet1AttendanceH","Sheet1AttendanceI","Sheet1AttendanceJ","Sheet1Att endanceK","Sheet1AttendanceL",
    "Sheet1AttendanceM","Sheet1AttendanceN","Sheet1AttendanceO","Sheet1AttendanceP" );
    // count the non-null fields;
    event.value = CountFields(aNames);
    As for the 2nd question, I've tried to do something similar to the previous script, but of course it doesn't work, but I am quite sure that the idea is similar:
    I don't know also how to add the other condition: the student should get A / Pass or B / Pass in order to consider he has finished??? and also how to check these condition from page 2, 3 and 4 and collect the date
    function Datefinished(bFields) {
    d2.value = nFields[i].value;
    for(i = 0; i < aFields.length; i++) {
    try {
    if(this.getField(aFields[i]).value == this.getField("NumberLines").value) d2.value = nFields[i].value;
    } catch(e) {
    if(e['message'] == "this.getField(aFields[i]) has no properties") app.alert("unknown field name: " + aFields[i]);
    else app.alert(e.toString());
    } // end catch
    } // end for aFields
    return nFields;
    // create array of field names to check
    var aNames = new Array("Texte00","Texte54","Texte56","Texte58","Texte60","Texte62","Texte64","Texte66","Te xte68","Texte70","Texte72","Texte74","Texte76","Texte78","Texte80","Texte82");
    var bNames = new Array("d1","d3","d4","d5","d6","d7","d8","d9","d10","d11","d12","d13","d14 ","d15","d16","d17");   // d1 is included because in some cases a student can finish in 1 day (short text);

  • How to calculate the store count in OBIEE?

    Hi Experts,
    In some case, I should write some measures for MDX language , but I do not know how to calculate it in logic layer in OBIEE 11.1.1.6.0.
    Note: The muti-datasource is ESSBASE and version is 11.1.1.2
    My requirement is as below:
    There are many dimensions in ESSBASE. Store is Location member. If one store has sales in one day, I should count it. So I want to count all stores for sales.
    If I write MDX in ESSBASE or logical layer in OBIEE directly, it will generate sum value in OBIEE for several day, not MAX value.
    For example:
    2012/11/29, it has 1500 stores.
    2012/11/30, it has 1510 stores.
    If users select two day, it will sum these value and be 3010 stores. The expect result is 1510.
    This is my MDX language in Logic Layer:
    EVALUATE_AGGR('MAX( Operation.currentmember.Siblings,%1)', "Sales Cube"."Sales".""."Sales"."Is_Close" )
    Thanks.

    Hi,
    Assuming that the report which you are trying to build is for BI/Dashboard purpose and if you take a case that you need the counts on Monthly basis then you can build your logic in following ways:
    Parameter - Month - Year (Apr 2013)
    Start Count = No of active employees present as of the last working day of the last Month (in this case as of 31st March 2013)
    No of New hires = No of employees who have DOJ between 01-APr-2013 and 30-APR-2013
    No of Left employees = No of employees who have Actual termination date between 01-APr-2013 and 30-APR-2013
    Transfer Out and In = Based on the business definition of transfer you can see the movements between 01-APr-2013 and 30-APR-2013 and build your logic
    Similarly you can build your logic for Quarter, Half yearly and yearly counts too.
    Hope it helps. Let me know if you need further details.
    Thanks,
    Sanjay

  • How to calculate the total sum value of a particular field that repeats

    Hi All,
    I have the following Req...File----Idoc Scenario
    In the Inbound xml file i will get the Sales Order details with suppose 10 line items( 10 Orders)
    Each line item represents one one SO. So totally i wil have 10 Sales Orders in this file.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Sales_Order xmlns:ns0="http://sap/Sales_Order">
       <Header>
          <COMP_CODE></COMP_CODE>
          <DOC_TYPE></DOC_TYPE>
           <SUPPL_VEND></SUPPL_VEND>
       </Header>
       <Item>
          <ITEM></ITEM>
          <MATERIAL></MATERIAL>
          <PLANT></PLANT>
          <QUANTITY></QUANTITY>
          <Amount></Amount> 
    </Item>
    In the above structure Item Segment will repeats as many no. of Sales Orders comes in a file.
    In a file if there are 10 Orders means the Item segment wil repeats 10 times.
    I have the Amount field in the Item Segment, each and every time that needs to be added to next Amount value that presents in the next Line Item.
    Finally i will have the Another separate field caled Grand Total, and i have to get the total summation of the 10 values of the Amount field at last.
    Can we achieve this using UDF or is there any way to do this
    REgards

    Hi,
    Do like this, actually in your case sum is taking place before the condition check for discount type
    do a little change in mapping
    DiscntType--removeContext--
                                              EqulsS-------IfWithoutElse----Amount---removecontext--then---SUM-
    Connstatnt(Value)
    --->GrandAmount
    Krishna, Check the same question asked by Rajesh in thread Calculate totals of segments that occur multiple times
    Thanks!

  • How to calculate the total running time for process from sysssislog entries

    Hi All,
    I have the below query which gets me the log entries form the logs table when the process started/completed.
    Select row_number() over (order by starttime) row_num,Substring( Substring(message, CharIndex('''',message) +1 ,Len(message)) ,0, CharIndex('''',Substring(message, CharIndex('''',message) +1 ,Len(message)))) as Description,
    starttime,endtime,message
    from dbo.sysssislog
    where (message like 'start%' or message like 'finish%' ) and
    LEFT(Substring( Substring(message, CharIndex('''',message) +1 ,Len(message)) ,0, CharIndex('''',Substring(message, CharIndex('''',message) +1 ,Len(message)))),1) between 'A' and 'Z'
    order by starttime
    However,I have to build a report on the top of it showing how much time that attribute/dimension/heirarchy took to execute(Ex-How much time did YearlyReview dimension take to complete).I dont have much knowledge of T-SQL and unable to figure out how to calculate
    that on SQL or report level.
    Could someone please assist me in getting the exact query for that?
    Thanks a lot.

    I get the below output(sample 20 rows) on executing this query.Also,a start process does not necessarily follow up a finished message for the same dimension as it may have been stopped or it failed.So we need to leave it as NA in case it started but dint
    finish
    Row_Num Description starttime endtime Message
    1 PAC SC Super Type 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC SC Super Type' dimension.
    2 PAC SC Super Type 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC SC Super Type' dimension.
    3 Team Member Indicator 12/13/12 16:38 12/13/12 16:38 Started processing the 'Team Member Indicator' dimension.
    4 Team Member Indicator 12/13/12 16:38 12/13/12 16:38 Started processing the 'Team Member Indicator' dimension.
    5 PAC SC Super Type 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'PAC SC Super Type' attribute.
    6 PAC SC Super Type 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'PAC SC Super Type' attribute.
    7 Specialist Merger Indicator 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'Specialist Merger Indicator' attribute.
    8 Specialist Merger Indicator 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'Specialist Merger Indicator' attribute.
    9 YearlyReview 12/13/12 16:38 12/13/12 16:38 Started processing the 'YearlyReview' dimension.
    10 YearlyReview 12/13/12 16:38 12/13/12 16:38 Started processing the 'YearlyReview' dimension.
    11 PAC SC Repeat Caller 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC SC Repeat Caller' dimension.
    12 PAC SC Repeat Caller 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC SC Repeat Caller' dimension.
    13 Year 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'Year' attribute.
    14 Year 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'Year' attribute.
    15 Staffing Function 12/13/12 16:38 12/13/12 16:38 Started processing the 'Staffing Function' dimension.
    16 Staffing Function 12/13/12 16:38 12/13/12 16:38 Started processing the 'Staffing Function' dimension.
    17 PAC SC Repeat Caller 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'PAC SC Repeat Caller' attribute.
    18 PAC SC Repeat Caller 12/13/12 16:38 12/13/12 16:38 Started reading data for the 'PAC SC Repeat Caller' attribute.
    19 PAC HV Cust 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC HV Cust' dimension.
    20 PAC HV Cust 12/13/12 16:38 12/13/12 16:38 Started processing the 'PAC HV Cust' dimension.

  • How to calculate the total  length of a Line

    Hi,
    We are using Mapviewer for representing for spatial data in form of a Image .
    We are using Mapviwer.addLinearFeaure for drawing lines on the Image( browser)
    Thsese lines are drawn .
    Now our requirement is we need to calculate the length of the lines in our Image .Please tell me how to do this .
    Thanks in advance
    Edited by: user672373773 on Nov 11, 2009 9:11 AM

    You can do this by two ways.
    1) create SDO_GEOMETRY from your coordinates and use SDO_GEOM.SDO_LENGTH to get length of the line.
    Or
    2) iterate your line points coordinate array and calculate distance between points add it to final length.
    Here is snippet to calculate length of line (not tested)
    length = 0;
    for( i=0; i<coordpts.length-2; i++) {
    length = length + getDistance(coordpts[0], coordpts[1]);
    to calculate distance between 2 points use below code (getDistance() source code)
    double dblDistance = Math.sqrt(Math.pow((dblPt2[0] - dblPt1[0]), 2) + Math.pow((dblPt2[1] - dblPt1[1]), 2));
    In both case you need to convert screen coordinate to map coordinate.
    Sujnan

  • How to Calculate the total orders for Items with supplier

    How do I write a function or SQL query that will give me the total quantity of an item that an organization has on order with other suppliers? Any help would be greatly appreciated. Thank you.

    It would help if you provided the description of the tables.
    To do totals by say item_id
    select item_id, sum(quantity)
          from supply_table A
          where org_id = 1
               and exists (select 1 from supplier B
                                         where a.org_id = b.org_id )
    group by item_id
    How do I write a function or SQL query that will give me the total quantity of an item that an organization has on order with other suppliers? Any help would be greatly appreciated. Thank you.

  • How to get the total count of the no. or rows a cursor has fetched

    Hi All,
    Is there a way to get the number of rows a cursor query has fetched, without looping into the cursor and using a counter variable
    I mean like in pl/sql table we can directly use the pl/sql table attribute .count is there a way to achieve this in cursor
    thanks a lot in advance

    Qwerty wrote:
    Is there a way to get the number of rows a cursor query has fetched, without looping into the cursor and using a counter variableYes.
    It is zero.
    On the first loop and first fetch it will be 1, second 2 etc.
    This is because cursors have no rows, or fetch no rows until your code or the client uses the cursor to fetch them.
    I mean like in pl/sql table we can directly use the pl/sql table attributeA PL/SQL array is not like a cursor, a PL/SQL array has the rows already fetched into it.
    A cursor is not an array but a pointer to a compiled SQL statement so you cannot count how many rows it has, because it has none. You can only count how many rows you fetch from it.

  • [Forum FAQ] How to upgrade the Linux Integration Service

    Symptom
    When you move a Linux guest virtual machine from the legacy system to Windows Server 2012 R2 Hyper-V host, you may face the incompatibility issues. The most common problems are that the mouse pointer maybe a little inaccuracies, the guest VM cannot use the
    dynamic memory.
    Cause
    The cause may be that the integration service not compatible with the Windows Server 2012 R2 Hyper-V host.
    Solution
    We need to upgrade the integration service to at least version 3.5.
    In this demo, we use the CentOS 5.8_x86_x64.
    You can refer to the following steps to perform the upgrading.
    1. Before install the Integration service you can use the following command to check the version of the installed Integration service. (Figure 1)
    #su root
    #/sbin/modinfo hv_vmbus
    Figure 1: check the version of the installed Integration service
    2. Download the Integration Service 3.5 image from here.
    http://www.microsoft.com/en-us/download/details.aspx?id=41554
    3. Insert the Integration Service 3.5 image.
    a. Open Hyper-V Linux guest VM console.
    b. Click-> Media->DVD Drive-> Specific the Integration service image location, insert Disk.
    4. Mount the image.
    If automount is enable, the Integration service image will be mounted automatically. If not, please use the following command to mount the image. (Figure 2)
    #mount /dev/cdrom /media
    Figure 2: Mount the image
    After that, we can see the image content. (Figure 3)
    Figure 3: Imange content
    5. Upgrade the integration service.
    Use the following command locate to the current Linux Distribution Directory. In this example, we select the RHEL58. (Figure 4)
    #cd RHEL58
    #./upgraee.sh
    Figure 4: Locate the Linux Distribution Directory
    When you see the message, "Linux Integration Service for Hyper-V has been upgraded. Please reboot your system", it means the upgrading is finished.
    6. Reboot your Linux system. (Figure 5)
    Figure 5: Reboot the system
    7. Confirm the upgrading.
    After Linux boots up, use the following command to check if the upgrading is succeed. (Figure 6)
    #/sbin/modinfo hv_vmbus
    Figure 6: Verify the upgrading.
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    May be you should write a WIKI article on same.

  • How to get the total amount of filtered row in a table view

    I have created filter tables for each columns of my tableview. Now I want to add a row with some totals. For this I use an iterator and implement the RENDER_ROW_START. It is easy to add a new lines knowing the number of expected rows (add the line at the end). But the hic comes when there is a filter. How can I know how many rows I will have in the filtered table. There is no parameters that I found. Not even in an event handler.
    Thanks a lot in advance for your help

    i found the solution, thanks

Maybe you are looking for

  • Can't print more than one job at a time.

    I am trying to print to either a HP DesignJet 1055cm plotter or a HP LaserJet 5000N. I can't send more than one file at a time. If i don't wait until the current job starts printing, the next one won't print. For example if I sent five files one righ

  • Error in BAPI Coding

    Hi Experts, I am new to interfaces like bapi, I tried a program for BAPI_ACC_DOCUMENT_POST to update AR, when i trying to execute it is displayng as "PROBLEM OCCURED". Here i am giving program code, so please see the program and reslove my eror. <rem

  • What to delete on internal HD if using external HD for storage

    Need to free up mac mini 2010 HD space of 200 GB of music.  Currently have an EHD as a backup and may add another for backup.  What gets deleted on the internal HD if I have my itunes backed up to the two EHDs.  I deleted somethiong on my emac years

  • [Solved] Package version format confusion: 1:0.16.17-1 = 1.0?

    I'm having troubles understanding the versioning scheme used above. According to the libtorrent site, the latest version of libtorrent-rasterbar is 1.0, released on 2014-07-02. Our package has the "last updated" date of 2014-07-24, so I assumed we ha

  • Truncating a large database failed

    if (0 != dbp->truncate(dbp, NULL, &countp, 0)){ out_string(c, "ERROR"); }else{ out_string(c, "OK"); If only a few records in database, it works. But when millions of records, it fails. Is there a need to set following three parameters? DB_ENV->set_lk