Use LINQ to extract the data from a file...

Hi,
I have created a Subprocedure CreateEventList
which populates an EventsComboBox
with a current day's events (if any).
I need to store the events in a generic List communityEvents
which is a collection of
communityEvent
objects. This List needs to be created and assigned to the instance variable
communityEvents.
This method should call helper method ExtractData
which will use LINQ to extract the data from my file.
The specified day is the date selected on the calendar control. This method will be called from the CreateEventList.
This method should clear all data from List communityEvents.  
A LINQ
query that creates CommunityEvent
objects should select the events scheduled for selected
day from the file. The selected events should be added to List
communityEvents.
See code below.
Thanks,
public class CommunityEvent
private int day;
public int Day
get
return day;
set
day = value;
private string time;
public string Time
get
return time;
set
time = value;
private decimal price;
public decimal Price
get
return price;
set
price = value;
private string name;
public string Name
get
return name;
set
name = value;
private string description;
public string Description
get
return description;
set
description = value;
private void eventComboBox_SelectedIndexChanged(object sender, EventArgs e)
if (eventComboBox.SelectedIndex == 0)
descriptionTextBox.Text = "2.30PM. Price 12.50. Take part in creating various types of Arts & Crafts at this fair.";
if (eventComboBox.SelectedIndex == 1)
descriptionTextBox.Text = "4.30PM. Price 00.00. Take part in cleaning the local Park.";
if (eventComboBox.SelectedIndex == 2)
descriptionTextBox.Text = "1.30PM. Price 10.00. Take part in selling goods.";
if (eventComboBox.SelectedIndex == 3)
descriptionTextBox.Text = "12.30PM. Price 10.00. Take part in a game of rounders in the local Park.";
if (eventComboBox.SelectedIndex == 4)
descriptionTextBox.Text = "11.30PM. Price 15.00. Take part in an Egg & Spoon Race in the local Park";
if (eventComboBox.SelectedIndex == 5)
descriptionTextBox.Text = "No Events today.";

Any help here would be great.
Look, you have to make the file a XML file type -- Somefilename.xml.
http://www.xmlfiles.com/xml/xml_intro.asp
You can use NotePad XML to make the XML and save the text file.
http://support.microsoft.com/kb/296560
Or you can just use Notepad (standard), if you know the basics of how to create XML, which is just text data that can created and saved in a text file, which, represents data.
http://www.codeproject.com/Tips/522456/Reading-XML-using-LINQ
You can do a (select new CommunityEvent) just like the example is doing a
select new FileToWatch and load the XML data into the CommunityEvent properties.
So you need to learn how to make a manual XML textfile with XML data in it, and you need to learn how to use LINQ to read the XML. Linq is not going to work against some  flat text file you created. There are plenty of examples out on Bing and Google
on how to use Linq-2-XML.
http://en.wikipedia.org/wiki/Language_Integrated_Query
<copied>
LINQ extends the language by the addition of query
expressions, which are akin to
SQL statements, and can be used to conveniently extract and process data from
arrays, enumerable
classes, XML documents,
relational databases, and third-party data sources. Other uses, which utilize query expressions as a general framework for readably composing arbitrary computations, include the construction of event handlers<sup class="reference" id="cite_ref-reactive_2-0">[2]</sup>
or
monadic parsers.<sup class="reference" id="cite_ref-parscomb_3-0">[3]</sup>
<end>
<sup class="reference" id="cite_ref-parscomb_3-0"></sup>

Similar Messages

  • Extract the data from xbrl source

    Hi ,
    I want to extract the data from xbrl source system . I have one xsd, few xml files and one xbrl file .   I have imported xsd file  but lot of the xml files failing to parse against xsd.
    Please guide me how to extract the data from xbrl file .
    Thanks & Regards,
    Ramana.

    Hi,
              Yes it will work, follow the bellow steps,
    Steps
    1) Create a blank database in Microsoft Access, lets call it 'TestDB.mdb'. I saved this mdb file in my XI server path itself,
    xiserver\xitemp\db\TestDB.mdb
    (you can save it anywhere provided it has a shared access)
    2) Add a table in TestDB.mdb, call it TEST_EMPLOYEE with the following rows and save it.
    EMPID type text
    EMPNAME type text
    EMPAGE type number
    FLAG type text
    3) Now follow the same steps as mentioned in the blog,
    /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30
    except for the receiver jdbc adapter configuration.
    4) In the receiver JDBC adapter configuration pass the following parameters,
    Transport Protocol: JDBC 2.0
    Message Protocol: XML SQL Format
    Adapter Engine: Integration Server
    JDBC Driver: jdbc.odbc.JdbcOdbcDriver
    Connection: jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=//xiserver/xitemp/db/TestDB.mdb
    5) In my case there is no userid and password required, but if you have userid and password, then the parameter for Connection becomes,
    jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=//xiserver/xitemp/db/TestDB.mdb;Uid=yourid;Pwd=yourpwd;
    Reward Points ,if found Useful.
    Thanks,
    Satish.

  • Unable to extract the data from ECC 6.0 to PSA

    Hello,
    I'm trying to extract the data from ECC 6.0 data source name as 2LIS_11_VAHDR into BI 7.0
    When i try to load Full Load into PSA , I'm getting following error message
    Error Message: "DataSource 2LIS_11_VAHDR must be activated"
    Actually the data source already active , I look at the datasource using T-code LBWE it is active.
    In BI  on datasource(2LIS_11_VAHDR) when i right click selected "Manage"  system is giving throughing below error message
    "Invalid DataStore object name /BIC/B0000043: Reason: No valid entry in table RSTS"
    If anybody faced this error message please advise what i'm doing wrong?
    Advance thanks

    ECC 6.0 side
    Delete the setup tables
    Fill the data into setup tables
    Schedule the job
    I can see the data using RSA3 (2LIS_11_VAHDR) 1000 records
    BI7.0(Service Pack 15)
    Replicate the datasource in Production in Backgroud
    Migrate Datasource 3.5 to 7.0 in Development
    I did't migrate 3.5 to 7.0 in Production it's not allowing
    When i try to schedule the InfoPakage it's giving error message "Data Source is not active"
    I'm sure this problem relate to Data Source 3.5 to 7.0 convertion problem in production. In Development there is no problem because manually i convert the datasource 3.5 to 7.0
    Thanks

  • Not able to extract performance data from .ETL file using xperf commands. getting error "Events were lost in this trace. Data may be unreliable ..."

    Not able to extract  performance data from .ETL file using xperf commands.
    Xperf Commands:
    xperf –i C:\TempFolder\Test.etl -o C:\TempFolder\BootData.csv  –a process
    Getting following error after executing above command:
    "33288636 Events were lost
    in this trace. 
    Data may be unreliable
    This is usually caused
    by insufficient disk bandwidth for ETW lo
    gging.
    Please try increasing the minimum
    and maximum number of buffers
    and/or
                    the buffer size. 
    Doubling these values would be a good first at
    tempt.
    Please note, though, that
    this action increases the amount of me
    mory
                    reserved
    for ETW buffers, increasing memory pressure on your sce
    nario.
    See "xperf -help start"
    for the associated command line options."
    I changed page size file but its does not work for me.
    Any one have idea, how to solve this problem and extract ETL file data.

    I want to mention one point here. I have total 4 machines out of these 3 machines above
    commands working properly. Only one machine has this problem.<o:p></o:p>
    Hi,
    I consider that you can try to use xperf to collect the trace etl file and see if it can be extracted on this computer:
    Refer to following articles:
    start
    http://msdn.microsoft.com/en-us/library/windows/hardware/hh162977.aspx
    Using Xperf to take a Trace (updated)
    http://blogs.msdn.com/b/pigscanfly/archive/2008/02/16/using-xperf-to-take-a-trace.aspx
    Kate Li
    TechNet Community Support

  • How can I extract the data from Xstring .

    Hi Gurus ,
    How can I extract the data from a XSTRING  .
    I have to get the data which is filled in the survey form the data is getting saved in form of xstring .
    Someone told me that there is a standard FM for that . but I am not able to find .
    Please reply with the FM in case some one knows about it .
    Thanks in advance .

    The following code works as of 7.0 (in any SAP system):
    FORM XSTRING_TO_STRING USING input TYPE xstring CHANGING output TYPE string.
    TYPES : BEGIN OF ty_struc,
              line TYPE c LENGTH 100,
            END OF ty_struc.
    DATA lt_char TYPE TABLE OF ty_struc.
    DATA length TYPE i.
    length = xstrlen( input ) / cl_abap_char_utilities=>charsize.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer                = input
      tables
        binary_tab            = lt_char.
    CONCATENATE LINES OF lt_char INTO output RESPECTING BLANKS.
    output = output(length).
    ENDFORM.
    Edited by: Sandra Rossi on Mar 30, 2010 12:24 AM

  • How can I use Automator to extract specific Data from a text file?

    I have several hundred text files that contain a bunch of information. I only need six values from each file and ideally I need them as columns in an excel file.
    How can I use Automator to extract specific Data from the text files and either create a new text file or excel file with the info? I have looked all over but can't find a solution. If anyone could please help I would be eternally grateful!!! If there is another, better solution than automator, please let me know!
    Example of File Contents:
    Link Time =
    DD/MMM/YYYY
    Random
    Text
    161 179
    bytes of CODE    memory (+                68 range fill )
    16 789
    bytes of DATA    memory (+    59 absolute )
    1 875
    bytes of XDATA   memory (+ 1 855 absolute )
    90 783
    bytes of FARCODE memory
    What I would like to have as a final file:
    EXCEL COLUMN1
    Column 2
    Column3
    Column4
    Column5
    Column6
    MM/DD/YYYY
    filename1
    161179
    16789
    1875
    90783
    MM/DD/YYYY
    filename2
    xxxxxx
    xxxxx
    xxxx
    xxxxx
    MM/DD/YYYY
    filename3
    xxxxxx
    xxxxx
    xxxx
    xxxxx
    Is this possible? I can't imagine having to go through each and every file one by one. Please help!!!

    Hello
    You may try the following AppleScript script. It will ask you to choose a root folder where to start searching for *.map files and then create a CSV file named "out.csv" on desktop which you may import to Excel.
    set f to (choose folder with prompt "Choose the root folder to start searching")'s POSIX path
    if f ends with "/" then set f to f's text 1 thru -2
    do shell script "/usr/bin/perl -CSDA -w <<'EOF' - " & f's quoted form & " > ~/Desktop/out.csv
    use strict;
    use open IN => ':crlf';
    chdir $ARGV[0] or die qq($!);
    local $/ = qq(\\0);
    my @ff = map {chomp; $_} qx(find . -type f -iname '*.map' -print0);
    local $/ = qq(\\n);
    #     CSV spec
    #     - record separator is CRLF
    #     - field separator is comma
    #     - every field is quoted
    #     - text encoding is UTF-8
    local $\\ = qq(\\015\\012);    # CRLF
    local $, = qq(,);            # COMMA
    # print column header row
    my @dd = ('column 1', 'column 2', 'column 3', 'column 4', 'column 5', 'column 6');
    print map { s/\"/\"\"/og; qq(\").$_.qq(\"); } @dd;
    # print data row per each file
    while (@ff) {
        my $f = shift @ff;    # file path
        if ( ! open(IN, '<', $f) ) {
            warn qq(Failed to open $f: $!);
            next;
        $f =~ s%^.*/%%og;    # file name
        @dd = ('', $f, '', '', '', '');
        while (<IN>) {
            chomp;
            $dd[0] = \"$2/$1/$3\" if m%Link Time\\s+=\\s+([0-9]{2})/([0-9]{2})/([0-9]{4})%o;
            ($dd[2] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of CODE\\s/o;
            ($dd[3] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of DATA\\s/o;
            ($dd[4] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of XDATA\\s/o;
            ($dd[5] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of FARCODE\\s/o;
            last unless grep { /^$/ } @dd;
        close IN;
        print map { s/\"/\"\"/og; qq(\").$_.qq(\"); } @dd;
    EOF
    Hope this may help,
    H

  • How to Extract the data from Microsoft BI to SAP BI 7

    Dear All,
    We have a requirement to Extract the data from Microsoft BI to Sap BI 7. How can we achieve this??
    Shall we use the DB connection for this??
    If anyone knows about this please give me some suggestion.
    Thanks in advance
    Sathiya

    Hi All,
    How to include the DBMS name when I give the connection. We are using the Data base as MS-BI.
    Please guide me
    Thanks in advance.
    Regards
    Sathiya

  • How to extract the data from R/3?

    Gurus,
    I need to extract the data from R/3 to BI . Below i am giving Table name followed by field name and field description.
    I am using BI 7.0 and ECC 6.0
    I am having following doubts.
    1. Based on below information which extract method I need to use (Generic data  Extraction?)?
    2. I try to create a one view but I could not find Join between the tables. I found only few joins. how to join other tables?
    3. Without joining these table how can I collect the data ?
    4. Do i need to create multiple tables?
    SAP Table      SAP Field        Field Description
    VBAK->             VBELN->        Sales Document
    VBAP->             WERKS->        Plant
    VBAK->              AUART->            Doc Type
    VBAP->             PSTYV->        Item Category
    VBAP->             MATNR->        Material
    VBAP->             ARKTX->        Description
    MATNR->              GROES->     
    VBAP->             ZIEME->        Target Quantity UOM
    VBAP->             WAVWR->        Cost
    VBAK->             ERNAM->        Name of a person who created the object
    VBAKA->             KUNNR->        Customer Number 1
    VBAP->             BSTNK->                 Customer purchase Order no
    VBEP->             BANFN->        Purchase Requisition Number
    QMFE->             FEGRP->        Cause Code(Code Group Problem)
    QMFE->             FECOD->        Damage Code(Problem or Damage Code)
    QMEL->             QMNUM->        Notification No
    EQUI->             EQUNR->        Equipment Number
    QMEL->             QMART->        Notification Type
    QMELI->             ERDAT->        Date on Which Record Was Created
    ============================================================================================
    Gurus I will assign full points .
    Thanks

    Hi,
    I would use the standard extractor 2lis_11_vaitm and enhance it for the following fields:
    VBEP-> BANFN-> Purchase Requisition Number
    QMFE-> FEGRP-> Cause Code(Code Group Problem)
    QMFE-> FECOD-> Damage Code(Problem or Damage Code)
    QMEL-> QMNUM-> Notification No
    EQUI-> EQUNR-> Equipment Number
    QMEL-> QMART-> Notification Type
    QMELI-> ERDAT-> Date on Which Record Was Created
    regards
    Siggi

  • HOw to connect and extract the data from MS ACCESS SOURCE(Database) system

    Hi experts ,
    I have to extract the data from MS access database system using JDBC adapter will it work if Yes HOW?

    Hi Sushma,
    how to configure sendor JDBC adapter ..
    Select adapter type is JDBC..
    Give the Transport Protocol:.JDBC 2.0 (Example)............
                Message Protocol:...JDBC...........
                IAdapter Engine : Integration Server
    Processing Parameters..
    Quality of service.....(Example)..Exactly once
    Poll Interval .... Example ..10
    Query Sql statement..Example ..select * from XXXXX
    Document Name.....
    Update Sql stetement.....
    Thanks,
    Satya
    Reward points if it id useful...

  • Can't extract the data from sourse system

    hi,everyone
       i have a question about extracting the data from sourse system.i created a general datasourse.in the r3 system,i used t-code:rsa3 to extract the data successful. but ,when i replicate the datasourse to the bw system,i can't extract the data to the psa. in the process of the extracting,accur a error like below:
    Errors while sending packages from OLTP to BI
    Diagnosis
    No IDocs could be sent to BI using RFC.
    System Response
    There are IDocs in the source system ALE outbox that did not arrive in the ALE inbox of BI.
    Further analysis:
    Check the TRFC log.
    You can access this log using the wizard or the menu path "Environment -> Transact. RFC -> In source system".
    Error handling:
    If the TRFC is incorrect, check whether the source system is fully connected to BI. In particular, check the
    authorizations of the background user in the source system.
    who can tell me why?
    thx
    zhang

    Hi zhang,
    Please check the below points.
    1. Perform the connection and authorization test in SM59 for the RFC connecion.
    2. Make sure the RFC user extracting the data is having sufficient authorization and correct profile as per note 150315.
    3. make sure there are sufficient number of Dialog process in BW in SM50.
    4. check T code SM58 in source system for any more errors.
    5. check the connection between the systems.
    Check
    Note 561880 - Requests hang because IDocs are not processed.
    Note 535172 - IDoc: Dup. IDocs in tRFC inbound processing w/ runtime error
    Note 555229 - IDocs hang in status 64 for tRFC with immediate processing
    Hope this helps.
    Regards,
    Suman.T

  • Need to extract the data from the CRM table : SCAPPTSEG

    Hi BW Experts,
    I want to extract the Data from CRM Table "SCAPPTSEG" to BW. The dates are stored in UTC Format.So for getting the date in CET format, we have used the Function Module "IB_CONVERT_FROM_TIMESTAMP".
    I want to create a datasource for extracting the data from "SCAPPTSEG" table and i need to use the function module for getting the date in CET Format.
    Can i achieve this action through Generic Extraction.
    please provide me the steps to achieve this.
    Thanks,
    Shahina.A

    not answered

  • Error occured while extracting the data from BSIK Table

    Hi Experts,
    I am trying to extract the data from "BSIK"  by using generic extraction by table, I am getting the error "Invalid extractiion Structure template BSIK of Data source XXXXXX", But when i am trying the same by using VIEW, i am able to do it,
    I am getting same problem while extracting the data from other tables like "BSIK, BSAK.........."
    can some one explain me why it is throughing some error when i am doing generic extraction by using Table,
    Thanks,

    Hi,
    Can you check below link:
    Invalid extract structure template ZBW_VW_EKES of DataSource ZBW_SCN_VENDOR
    Hope this answer your question!
    Regards,
    Nilima

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • How  to load the data from excel  file  into table in oracle using UTL_FI

    How to load the data from excel file into table in oracle
    and from table to excel file
    using UTL_FILE package
    Please give me some example

    This is something i tried in oracle apex
    http://avdeo.com/2008/05/21/uploading-excel-sheet-using-oracle-application-express-apex/
    Regards,
    CKLP

  • Is it possible to Extract the Data from Website?

    Dear Experts,
            Is it possible to Extract the Data from Website and Upload it in the SAP Table?.It is very Urgent.Please help me.
    Thanks & Regards,
    Ashok.

    Hi Friend,
    Generaly if it is one time activity you can do it manually by copy paste in excel.
    But if it is weekly or monthly activity then you have to ask website provide to provide data in excel or CSV file and upload it into SAP.
    I have a situtation like this, and they (Rapaport price) provide it in CSV format with defined columns.
    So it is better to raise the issue to website provider.
    Regards
    Krishnendu

Maybe you are looking for

  • GE70 2PE-012 Apache Pro Windows 8 Reinstall

    Hi, I am trying to reinstall windows 8 onto my GE70 Apache Pro: Steps I followed: Made 5 Disc in MSI's Burn Recovery for Windows 8 Recovery Disc Put the first disc in, restarted computer, hit F11, booted from DVD Rom. Then it takes me to recovery cen

  • How do I run a Windows virtual machine?

    I have a program for my research (Scigress) that only runs on Windows. I would like to be able to run the program on my Mac, I assume the best way to do that is to run a virtual machine. I don't want to run Windows all the time, since I strongly disl

  • Set focus on cell in ATS Table

    Hi Friends, I try to set the focus on a field in a if_fpm_guibb_list. I use Methode request_focus_on_cell in if_fpm_list_ats_ext_ctrl. And I set lead Index to new line and set selected_line _changes to 'X'. When I look in the table what contain the n

  • How to create an eclipse plugin?

    Hello! I'm looking for tutorials, manuals, ebooks about creating my own eclipse plug-ins. There is no forum category specially dedicated for that so i'm writing my post here... Thanks.

  • Cs5 font error

    I have several files saved that I have created.  Today when I go to open one to make edits to, it tells me that my font no longer exists.  I work for a credit union and this is our font.  How do I get it back?