Date from a string and int value in ssis

hi so my table is as follows
active      expirymonth     
expiryyear
0              October                         2014
0              February                            2015
1               January                        2012
and so on
now my requirement is that if active =0 then in a new table lets say LASTDATE and they want a date with the last day of the expiry month and year  and if active is anything else write NULL for eg
LASTDATE
10/31/2014
02/28/2015
NULL
I went to derived tables and made a new table called lastdate. What expression do i build in the expression builder to get the required result as i could not find a way to convert the text into int and then into a date

Hi Bharatb111,
If you want to achieve this using Derived Columns transform, you have to use following expression to first convert the month name value to integer:
([expirymonth]==”January”)?1:([expirymonth]==“February”)?2: ([expirymonth]==”March”)?3:([expirymonth]==“April”)?4:5
However, if we need to validate a couple of or even all of twelve months, the expression validation will be failed. So, the Derived Column approach is impossible.
To achieve your goal, you can use a Script Component to perform the date format conversion. This way, we can convert “dd/MMMM/yyyy(such as “01/October/2014”) format string value to “MM/dd/yyyy” (such as “10/01/2014”), and assign this value to a new output
column (assuming its name is “DateVal” and its data type is DT_DATE) of the Script Component. Then, we can drag a Derived Column under the Script Component and connect them. In the Derived Column, we can add a new column named “LASTDATE” with the following
expression:
([active]==0)?DATEADD(“d”,-1, DATEADD(“Month”),1,DateVal]):NULL(DT_DATE)
For the Script Component code snippet, please refer to Reza’s answer:
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/1661339c-252c-4197-9cfd-943e1d86b573/convert-a-string-to-date-format?forum=sqlintegrationservices 
Hope this helps.
Regards,
Mike Yin
TechNet Community Support

Similar Messages

  • Retrieving data from an ArrayList and presenting them in a JSP

    Dear Fellow Java Developers:
    I am developing a catalogue site that would give the user the option of viewing items on a JSP page. The thing is, a user may request to view a certain item of which there are several varieties, for example "shirts". There may be 20 different varieties, and the catalogue page would present the 20 different shirts on the page. However, I want to give the user the option of either viewing all the shirts on a single page, or view a certain number at a time, and view the other shirts on a second or third JSP page.
    See the following link as an example:
    http://www.eddiebauer.com/eb/cat_default.asp?nv=2|21472|9&tid=&c=&sc=&cm_cg=&lp=n2f
    I am able to retrieve the data from the database, and present all of them on a JSP, however I am not sure how to implement the functionality so that they can be viewed a certain number at a time. So if I want to present say 12 items on a page and the database resultset brings back 30 items, I should be able to present the first 12 items on page1, the next 12 items on page2, and the remaining 6 items on page3. How would I do this? Below is my scriplet code that I use to retrieve information from the ArrayList that I retrieve from my database and present them in their entirety on a single JSP page:
    <table>
    <tr>
    <%String product=request.getParameter("item");
    ArrayList list=aBean.getCatalogueData(product);
    int j=0, n=2;
    for(Iterator i=list.iterator(); i.hasNext(); j++){
    if(j>n){
    out.print("</tr><tr>");
    j=0;
    Integer id=(Integer)i.next();
    String name=(String)i.next();
    String productURL=(String)i.next();
    out.print("a bunch of html with the above variables embedded inside")
    %>
    </tr>
    </table>
    where aBean is an instace of a JavaBean that retrieves the data from the Database.
    I have two ideas, because each iteration of the for loop represents one row from the database, I was thinking of introducing another int variable k that would be used to count all the iterations in the for loop, thus knowing the exact number. Once we had that value, we would then be able to determine if it was greater than or less than or equal to the maximum number of items we wanted to present on the JSP page( in this case 12). Once we had that value would then pass that value along to the next page and the for loop in each subsequent JSP page would continue from where the previous JSP page left off. The other option, would be to create a new ArrayList for each JSP page, where each JSP page would have an ArrayList that held all the items that it would present and that was it. Which approach is best? And more importantly, how would I implement it?
    Just wondering.
    Thanks in advance to all that reply.
    Sincerely;
    Fayyaz

    -You said to pass two parameters in the request,
    "start", and "count". The initial values for "start"
    would be zero, and the inital value for "count" would
    be the number of rows in the resultSet from the
    database, correct?Correct.
    -I am a little fuzzy about the following block of code
    you gave:
    //Set start and count for next page
    start += count; // If less than count left in array, send the number left to next next page
    count = ((start*3)+(count*3) < list.size()) ? (count) : ((list.size() - (start*3))/3)
    Could you explain the above block of code a little
    further please?Okay, first, I was using the ternary operators (boolean) ? val_if_true : val_if_false;
    This works like an if() else ; statement, where the expression before the ? represents the condition of the if statement, the result of the expression directly after the ? is returned if the condition is true, and the expression after the : is returned if the condition is false. These two statments below, one using the ternary ? : operators, and the other an if/else, do the same thing:
    count = ((start*3)+(count*3) < list.size()) ? (count) : ((list.size() - (start*3))/3);
    if ((start*3)+(count*3) < list.size()) count = count;
    else count = ((list.size() - (start*3))/3);Now, why all the multiplying by 3s? Because you store three values in your list for each product, 1) the product ID, 2) the product Name, and 3) the product URL. So to look at the third item, we need to be looking at the 9th,10th, and 11th values in the list.
    So I want to avoid an ArrayIndexOutOfBounds error from occuring if I try to access the List by an index greater than the size of the list. Since I am working with product numbers, and not the number of items stored in the list, I need to multiply by three, both the start and count, to make sure their sum does not exceed the value stored in the list. I test this with ((start*3)+(count*3) < list.size()) ?. It could have been done like: ((start + count) * 3 < list.size()) ?.
    So if this is true, the next page can begin looking through the list at the correct start position and find the number of items we want to display without overstepping the end of the list. So we can leave count the way it is.
    If this is false, then we want to change count so we will only traverse the number of products that are left in the list. To do this, we subtract where the next page is going to start looking in the list (start*3) from the total size of the list, and devide that by 3, to get the number of products left (which will be less then count. To do this, I used: ((list.size() - (start*3))/3), but I could have used: ((list.size()/3) - start).
    Does this explain it enough? I don't think I used the best math in the original post, and the line might be better written as:
    count = ((size + count)*3 < list.size()) ? (count) : ((list.size()/3) - start);All this math would be unnecessary if you made a ProductBean that stored the three values in it.
    >
    - You have the following code snippet:
    //Get the string to display this same JSP, but with new start and count
    String nextDisplayURL = encodeRedirectURL("thispage.jsp?start=" + start + "&count=" + count + "&item=" + product);
    %>
    <a href="<%=nextDisplayURL%>">Next Page</a>
    How would you do a previous page URL? Also, I need to
    place the "previous", "next" and the different page
    number values at the top of the JSP page, as in the
    following url:
    http://www.eddiebauer.com/eb/cat_default.asp?nv=2|21472
    9&tid=&c=&sc=&cm_cg=&lp=n2f
    How do I do this? I figure this might be a problem
    since I am processing the code in the middle of the
    page, and then I need to have these variables right at
    the top. Any suggestions?One way is to make new variable names, 'nextStart', 'previousStart', 'nextCount', 'previousCount'.
    Calculate these at the top, based on start and count, but leave the ints you use for start and count unchanged. You may want to store the count in the session rather than pass it along, if this is the case. Then you just worry about the start, or page number (start would be (page number - 1) * count. This would be better because the count for the last page will be less than the count on other pages, If we put the count in session we will remember that for previous pages...
    I think with the details I provided in this and previous post, you should be able to write the necessary code.
    >
    Thanks once again for all of your help, I really do
    appreciate the time and effort.
    Take care.
    Sincerely;
    Fayyaz

  • How to read a C structure with string and int with a java server using sock

    I ve made a C agent returning some information and I want to get them with my java server. I ve settled communication with connected socket but I m only able to read strings.
    I want to know how can I read strings and int with the same stream because they are sent at the same time:
    C pgm sent structure :
    char* chaine1;
    char* chaine2;
    int nb1;
    int nb2;
    I want to read this with my java stream I know readline methode to get the first two string but after two readline how should I do to get the two int values ?
    Any idea would be a good help...
    thanks.
    Nicolas (France)

    Does the server sent the ints in little endian or big endian format?
    The class java.io.DataInputStream (with the method readInt()) can be used to read ints as binary from the stream - see if you can use it.

  • Help combining output data from an HP4140B and a LakeShore 330

    Hi!
    First of all, I would like to apologize if this question has already been answered in the forums, but I haven't been able to find anything for this particular situation... I am using LabView v.8.6 so as to conduct TSC (thermally stimulated current) measurements, by controlling a Lake Shore Cryotronics 330 (Lake Shore Model 330 Autotuning Temperature Controller) and a HP4140B pA meter. I am taking as a starting point the VIs available in the driver libraries (http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=014FB74E7B0C1ED3E0440003BA7CCD... and http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=E3B19B3E92C3659CE034080020E748..., respectively), and I would like to merge both programs ("Lake Shore Cryotronics Controller Output.vi" and "HP4140B Example (current vs. voltage).vi") into a single program that can simultaneously record both the current values (at a fixed voltage) from the HP4140B and the temperature as it is changed in the 76K to 300K range (with the Lakeshore 330).
    The problem lies in the fact that I don't know how to make compatible the numeric output "Sample sensor data" of the Lakeshore with the numeric array (which does not have a defined size) named "current/cap" of the HP4140B in aforementioned programs. What I am trying to do is to: (1) save the data to a file (I have attempted using "Write to measurement file" Express block, which I am not sure of whether it's the best option or not); and (2) plot current vs. temperature (not current vs. time and temperature vs. time separately).
    Any help with these issues would be most appreciated, since I'm stuck on my research because I can't record any data! This really goes right over my head...
    PS: I enclose the file that I have been working on, but perhaps it's better to work from scratch (I'm still a newbie and I may have made errors!)
    Solved!
    Go to Solution.
    Attachments:
    Current_vs_Temp.vi ‏69 KB

    Kyle,
    Thank you for your response and sorry for having taken a while to reply, but the equipment is shared with other groups and I haven't had access to it in a while.
    I have managed to get the program running using LabVIEW 7.1 (I don't know why, but the HP4140B drivers don't seem to be compatible with LabVIEW 8.6) and using the "HP4140B Read Single Meas.vi" example (and not "HP4140B Read Wave Meas.vi", as I had tried before) so as to get a double instead of an array, avoiding synchronization problems when merging data from the HP4140B and the LakeSHore 330. Then I have used a do-while loop to get "continuous sampling" of the waveform. Nonetheless, because of having chosen this approach, now I can only use a fixed voltage, which would be of for a TSC measurement, except for the fact that I need to increase the voltage in small steps so as to avoid damaging the sample. I am using another do-while loop so as to keep increasing the voltage gradually (and also be able to update the LakeShore 330 parameters), and once the desired voltage is achieved, I press a "stop" button, allowing the program to flow into the next stage and take the measurements... I am aware that it's not an elegant solution, so if you can come up any ideas for an improved version, it would be most appreciated!
    Regards,
    Pablo
    Attachments:
    IvsTemp_LabVIEW7_final.vi ‏267 KB

  • Report to display (actuals data from one cube and plan from another)

    Hi Gurus,
             I have a requirement in reporting to display actual data from one cube and plan data from a different one.
            The example below might give a clear picture of the requirement.
    rows has key figures and columns = months
    Jan |  Feb |  Mar |  Apr |  May |  Jun  ...   ....
    GrossSales
    Net Sales   
    Now if I run the report for Current month (Apr), then for the months of (Jan, Feb and Mar) i need to get the data from CUBE1   and for the remaining months (Apr thru Dec) from CUBE2.
    Similarly when i run the report next month(may), 
    then (data for Jan, Feb, Mar, Apr  from CUBE1)
    and ( May thru Dec from CUBE2)
    Any suggestions.
    Thanks in Advance
    Kumar

    Hi Henry,
         We alreadey have a multi provider which includes
    FinDat Cube(CUBE1) for actuals and Comm.Goals cube (CUBE2) for plan.
    So you suggest that we have two versions of key figure for actual and plan.
    ie. each KF will have two versions.
    actuals = (version 10, FiscPer<curr.mnth, key figure, acutals cube)
    Plan = (version 20, FiscPer>=curr.mnth, key figure, comm.goals cube)
    eg:
    Jan | Feb | Mar | Apr | May | Jun ...
    GrossSales(Act)
    GrossSlaes(Plan)
    Net Sales(Acutal)
    Net Sales(Plan)
    Correct me if I am wrong.
    the report has a lot of key figures, having two versions for each kf will be confusing.
    the user would like to see
    Jan.....| ...Feb  |..Mar |..Apr.....|  May  | 
    GrossSales   Act Value|Act.V |Act.V| PlanVal|PlanVal|
    Net Sales
    where Act.Value is from CUBE1
             Plan Value is from CUBE2
    Thanks
    Kumar

  • Pull data from SQL Table and display it in mail

    I have a requirement to pull the data from SQL table and send it in email.  Currently I am sending the hard coded info in email but is it possible to pull some data from SQL Table and than format it and send it across in the same email? 
    Can you guide me with steps on this.
    Neil

    There are several ways to do this.  First is to populate a file in a data flow and then send that as an attachment in the send mail task. 
    As far as including the results in the email body this becomes a bit trickier.  To use a variable you would need to use an SSIS variable type of
    Object, this is similar to a collection in .NET.  The problem once the object is populated is that it isn't like a readable result set, but again more like an array or a collection.  There is no native method to take the object variable and
    specify .ToString() or cast its results as text.  You would need to iterate through each row and append it to another variable of type string, this could be done with a script task or ForEach container.
    Also you mentioned formatting the results.  What type of formatting were you looking for.  A limitation of the SMTP send mail task is that the message body doesn't support HTML so if you were looking at creating a table within the mail body you
    would have to use a script task or a custom component
    David Dye My Blog

  • How to read a data file combining strings and data

    Hello,
    I'm having a data file combining strings and datas to read. I'm trying to read the filename, time, constants and comments into four seperate string indicators (the lines for the comments varies for different files). And read the data into a 2-D numeric array. How can I do this? Is there any function that can serch special characters in the spreadsheet file so I can exactly locate where I should start reading the specific data. The following is how the data file appears. Thank you very much.
    Best,
    Richard
    filename.dat
    14:59:00 12/31/2009
    Sample = 2451
    Frequency = 300, Wait time = 2500
    Temperature = 20
    some comments
    some comments
    some comments
    some comments
    some comments
    7.0000E+2    1.5810E-5
    7.0050E+2    1.5400E-5
    7.0100E+2    1.5500E-5
    7.0150E+2    1.5180E-5
    Message Edited by Richard1017 on 10-02-2009 03:10 PM
    Solved!
    Go to Solution.

    Hi,
         I'm fairly new to the NI forums too and I think you just have to wait longer.  Your post was done right.  I do a similiar function as to what you are talking about except I read in numbers from a file.  I create an ini file (just a notepad file of type *.ini) that is is set up with sections inside brackets [] and keys with whatever name followed by an = sign.  You may be able to use a *.dat file too, I just haven't.  Then the vi attached goes to that file and reads the keys from those sections.  You just repeat for the different sections and keys you want to read.  You can use similar provide VI's to write to that same file or create it.  Let me know how that works. 
    Attachments:
    Help1.ini ‏1 KB
    Help1.vi ‏10 KB

  • Extract data from database tables and download in pdf and csv

    extract data from database tables and download in pdf and csv
    hi how can i re-write my old form procedure in adf java. the procedure used to extract data from diffirent table and dowload the data in pdf and csv.am not downloading image, i what to extract data from diffirent tables in my database and download that data in pdf and csv. i would like to write this in java adf.i just what direction am not asking anyone to do my work this is my learning curve
    the form code is
    function merge_header3 return varchar2 is
    begin
         return '~FACILITY DESCRIPTION~ACCOUNT NO~BRANCH CODE~BANK REF NO.~P/P/ AMOUNT~Postal Address 1~Postal Address 2~Box Postal Code~Dep. Date~Month~BANK NAME~BRANCH NAME~ACCOUNT TYPE~DESCRIPTION~OBJECTIVE DESCRIPTION';
    end;
    procedure download_file (i_pbat integer) is
      dir varchar2(80);
      file_name1 varchar2(80);
      file_name2 varchar2(80);
      appl_code varchar2(80);
      fil1 client_text_io.file_type;
      fil2 client_text_io.file_type;
      dat varchar2(1000);
      DATA VARCHAR2(1000);
      bvspro varchar2(100);
      ssch   varchar2(100);
      bvspro_total number(20,2);
      ssch_total   number(20,2);
      grand_total  number(20,2);
      cnt    integer;
      cursor pbat is
           select *
           from sms_payment_batches
           where id = i_pbat
      cursor pay  (pb_id integer) is
           select *
           from sms_payment_vw
           where pbat_id = pb_id
           order by subsidy ASC,programme,beneficiary_name
      cursor cgref (low varchar2) is
           select *
           from cg_ref_codes
           where rv_domain ='SMS'
           and rv_low_value = low
      success boolean;     
      begin  
           set_application_property(cursor_style,'busy');
           appl_code := sms_global.ref_code('SMS','APP_CODE','SMS',0);
        dir       := sms_global.ref_code('SMS','PAY_DIR','c:\sms\batch_payments',0);
             success := webutil_file.create_directory(dir);
         if webutil_file.file_is_directory(dir) then
             null;
    --         message ('directory exists');
        else
    --                  message ('create directory ');
             success := webutil_file.create_directory(dir);
    --         if success then        message ('directory exists');    end if;
        end if;     
        for c_pbat in pbat loop
             file_name1 := dir ||'\' || appl_code||c_pbat.batch_number||'-'||to_char(c_pbat.batch_dt,'yyyymmdd')||'pay.txt';
             file_name2 := dir ||'\' || appl_code||c_pbat.batch_number||'-'||to_char(c_pbat.batch_dt,'yyyymmdd')||'merge.txt';
    --message('create files ');
    --         fil1  := client_text_io.fopen (file_name1,'W');
    --         fil2  := client_text_io.fopen (file_name2,'W');
        fil1  := client_text_io.fopen (file_name1,'W','');
        fil2  := client_text_io.fopen (file_name2,'W','');
                   dat :=                       'FROM ACCOUNT NUMBER'
                                                                ||'~'||'FROM ACCOUNT DESCRIPTION'
                                                                ||'~'||'MY STATEMENT DESCRIPTION'
                                                                ||'~'||'BENEFICIARY ACCOUNT NUMBER'
                                                                ||'~'||'BENEFICIARY SUB ACCOUNT NUMBER'        
                                                                ||'~'||'BENEFICIARY BRANCH CODE'
                                                                ||'~'||'BENEFICIARY NAME'
                                                                ||'~'||'BENEFICIARY STATEMENT DESCRIPTION'
                                                                ||'~'||'AMOUNT';
             --     client_text_io.put_line(fil1,dat);
             bvspro:= null;
             ssch  := null;
             cnt := 0;     
             dat := '~'||lpad('~',16,'~');
             for c_pay in pay(c_pbat.id) loop
    --message('cpay loop ' || cnt);              
               if bvspro is null then
                     dat := lpad('~',16,'~');
                     dat := utility.put_field(1,c_pay.programme,dat,'~');     
               client_text_io.put_line(fil2,dat);
               dat := utility.put_field(1,c_pay.subsidy,dat,'~');
               client_text_io.put_line(fil2,dat);
               dat := merge_header3;
                     client_text_io.put_line(fil2,dat);
                     bvspro := c_pay.programme;
                     ssch := c_pay.subsidy;
                     grand_total := 0;
                     bvspro_total := 0;
                     ssch_total := 0;
               end if;
               if bvspro <> c_pay.programme then
                     dat := lpad('~',16,'~');
                     dat := utility.put_field(5,ssch_total,dat,'~');
                     dat := lpad('~',16,'~');
                     dat := utility.put_field(5,bvspro_total,dat,'~');
               dat := utility.put_field(1,'Total:' || bvspro,dat,'~');
                     client_text_io.put_line(fil2,dat);
                     dat := lpad('~',16,'~');
               client_text_io.put_line(fil2,dat);
                     dat := utility.put_field(1,c_pay.programme,dat,'~');     
               client_text_io.put_line(fil2,dat);
                     bvspro := c_pay.programme;
               dat := utility.put_field(1,c_pay.subsidy,dat,'~');
               client_text_io.put_line(fil2,dat);
               dat := merge_header3;
                     client_text_io.put_line(fil2,dat);
                     bvspro := c_pay.programme;
                     ssch := c_pay.subsidy;
                     bvspro_total := 0;
                     ssch_total := 0;
                     cnt :=0;
             end if;                           
               if ssch <> c_pay.subsidy then
                     dat := lpad('~',16,'~');
                     dat := utility.put_field(5,ssch_total,dat,'~');
                     dat := lpad('~',16,'~');
               client_text_io.put_line(fil2,dat);
               dat := utility.put_field(1,c_pay.subsidy,dat,'~');
               client_text_io.put_line(fil2,dat);
               dat := merge_header3;
                     client_text_io.put_line(fil2,dat);
                     ssch := c_pay.subsidy;
                     ssch_total := 0;
                     cnt :=0;
             end if;                           
            bvspro_total := bvspro_total + c_pay.amount;
            ssch_total   := ssch_total   + c_pay.amount;              
                  grand_total  := grand_total  + c_pay.amount;              
            cnt := cnt +1;
    --message('bfore write file 2 ' );              
            client_text_io.put_line(fil2
                                   ,cnt
                            ||'~'|| c_pay.beneficiary_name
                                                                ||'~'||c_pay.BENEFICIARY_ACCOUNT_NUMBER ||''            
                                                                ||'~'||c_pay.BRANCH_CODE             ||''           
                                                                ||'~'|| c_pay.BENEFICIARY_STATEMENT_DESC            
                                                                ||'~'|| c_pay.AMOUNT                                
                            ||'~'|| c_pay.address_line1
                            ||'~'|| c_pay.address_line2
                                                    ||'~'|| c_pay.postal_code
                                                    ||'~'|| TO_CHAR(c_pay.deposit_date,'DD-Mon-YYYY')
                                                    ||'~'|| c_pay.month
                                                    ||'~'|| c_pay.bank
                                                    ||'~'|| c_pay.bank_branch
                                                    ||'~'|| c_pay.account_type
                                                    ||'~'|| c_pay.subsidy
                                                    ||'~'|| c_pay.programme)
                  DATA :=                                  c_pay.FROM_ACCOUNT_NUMBER                   
                                                                ||'~'||c_pay.FROM_ACCOUNT_DESCR                    
                                                                ||'~'||c_pay.MY_STATEMENT_DESCR                    
                                                                ||'~'||c_pay.BENEFICIARY_ACCOUNT_NUMBER
                                                                ||'~'
                                                                ||'~'||c_pay.BRANCH_CODE            
                                                                ||'~'||c_pay.BENEFICIARY_NAME                      
                                                                ||'~'||c_pay.BENEFICIARY_STATEMENT_DESC            
                                                                ||'~'||c_pay.AMOUNT;                                
            DATA := REPLACE(DATA, ',' , ' ' );
            DATA := REPLACE(DATA, '~' , ',' );
    --message (cnt ||' ' || data);       
    --message('bfore write file 1 ' );              
                  client_text_io.put_line(fil1, data);
             end loop;
    --message ('end of write');         
                 dat := lpad('~',16,'~');
                 dat := utility.put_field(6,ssch_total,dat,'~');
                 dat := lpad('~',16,'~');
           dat := utility.put_field(1,'Total:' || bvspro,dat,'~');
                 dat := utility.put_field(5,bvspro_total,dat,'~');
              client_text_io.put_line(fil2,dat);
              dat := lpad('~',16,'~');
           client_text_io.put_line(fil2,dat);
           dat := utility.put_field(1,'Grand Total:' ,dat,'~');
                 dat := utility.put_field(5,grand_total,dat,'~');
              client_text_io.put_line(fil2,dat);
             -- close file
    for i in 1..50 loop  
           if substr(i,-1) = 0 then
                 message ('flush ' || i);
           end if;                 
                  client_text_io.put_line(fil1, lpad(' ',2000));
                  client_text_io.put_line(fil2, lpad(' ',2000));
                  client_text_io.put_line(fil1, lpad(' ',2000));
                  client_text_io.put_line(fil2, lpad(' ',2000));
    end loop;
             client_text_io.fclose(fil1);
             client_text_io.fclose(fil2);
        end loop;
       set_application_property(cursor_style,'default');
        exception
             when others then
                  message(sqlcode ||' ' ||sqlerrm);
       end download_file;    i try this but this code onlydownload image not data from database tables
        public void downloadImage(FacesContext facesContext, OutputStream outputStream)
            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
            // get an ADF attributevalue from the ADF page definitions
            AttributeBinding attr = (AttributeBinding) bindings.getControlBinding("DocumentImage");
            if (attr == null)
                return;
            // the value is a BlobDomain data type
            BlobDomain blob = (BlobDomain) attr.getInputValue();
            try
            {   // copy the data from the BlobDomain to the output stream
                IOUtils.copy(blob.getInputStream(), outputStream);
                // cloase the blob to release the recources
                blob.closeInputStream();
                // flush the output stream
                outputStream.flush();
            catch (IOException e)
                // handle errors
                e.printStackTrace();
                FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), "");
                FacesContext.getCurrentInstance().addMessage(null, msg);
            }

    You should ask your forum in the ADF-forum.

  • Import data from few tables and export into the same tables on different db

    I want to import data from few tables and export into the same tables on different database. But on the target database, additional columns have been added
    to the same tables. how can i do the import?
    Its urgent can anyone please help me do this?
    Thanks.

    Hello Junior DBA,
    maybe try it with the "copy command".
    http://download.oracle.com/docs/cd/B14117_01/server.101/b12170/apb.htm
    Have a look at the section "Understanding COPY Command Syntax".
    Here is an example of a COPY command that copies only two columns from the source table, and copies only those rows in which the value of DEPARTMENT_ID is 30:Regards
    Stefan

  • How can i Pick the data from the string

    Hi Gurus
    How can i Pick the data from the string using regular expressions. for ex:
    1) 10000-san0001
    2) 3000000-rani0001
    3) 30-super003
    its doesnt mainain how many characters.
    like this i got string. now i only want  after the symobl( -) text (san
                                                                                    rani
                                                                                    super)  .how can i pick that
    can anyone provide me regular expressions.
    Thanks & Regards
    Sandya
    Edited by: sandya rani on Jan 29, 2010 2:51 PM

    REPORT  ZTEST.
    data: str1 TYPE string,
    str2 TYPE string,
    str3 TYPE string,
    lenth TYPE string,
    str4 TYPE string,
    temp type i value '0'.
    data: ii type i value '0',
          jj type i value '1'.
    Data : begin of itab OCCURS 0,
    l_string type string,
    end of itab.
    itab-l_string = '3000000-GUNDALA20001'.
    append itab.
    clear itab.
    itab-l_string = '2045677-iCVj1001'.
    append itab.
    clear itab.
    itab-l_string = '3000-ragh30001'.
    append itab.
    clear itab.
    loop at itab.
      MOVE 0 TO ii.
      MOVE 1 TO jj.
      SPLIT itab-l_string AT '-' INTO: str1 str2 .
      clear: itab-l_string,str1.
      lenth = strlen( str2 ).
      while temp < lenth.
        str4 = str2+ii(jj).
        if str4 CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' or str4 CA 'abcdefghijklmnopqrstuvwxyz'.
          if sy-subrc = 0.
            CONCATENATE str3 str4 into str3.
          endif.
          ii = ii + 1.
        ENDIF.
        temp = temp + 1.
      ENDWHILE.
      write: / str3.
      clear: itab, ii, jj,str1, str2, str3, str4,temp, lenth.
    Endloop.

  • I want to store the data form the PWM and the value of the changing duty cycle into a file simultaneously and continually

    i want to store the data form the PWM and the value of the changing duty cycle into a file simultaneously and continually but having problem.Please can anyone help out.
    Attachments:
    data.vi ‏60 KB

    Hello,
    Have you looked at the "Write Binary File.vi" and "Read Binary File.vi" examples?
    They give you a good clue as how to write and read arrays to and from binary files.
    For your data it means that you could put the two data items to write in an array and write the array to file, for the read its important to in what sequence the number were written to file.
    Kind regards,
    André
    Regards,
    André
    Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)

  • 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 extract data from generic view and function module

    hi experts,
    can anybody give me the steps to extract data from generic view and  functon modules.
    thanks and regards
    venkat

    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33
    https://websmp103.sap-ag.de/~sapidb/011000358700007535452002
    Hope it Helps
    Chetan
    @CP..

  • HT1554 Apparently, I don't know my "com.apple.smig keychain" password. And I'm in the middle of setting up my new Mac mini. I transferred data from my MacBook and what I thought was the password isn't working! Help!!

    Apparently, I don't know my "com.apple.smig keychain" password. And I'm in the middle of setting up my new Mac mini. I transferred data from my MacBook and what I thought was the password isn't working! Help!!

    Hello,
    See if this helps...
    Mac OS X 10.4 Help, I forgot a password in my Keychain
    http://docs.info.apple.com/article.html?path=Mac/10.4/en/mh1960.html
    Mac OS X 10.4: Keychain Access asks for keychain "login" after changing login password...
    http://support.apple.com/kb/HT1631
    Resetting your keychain in Mac OS X...
    If Keychain First Aid finds an issue that it cannot repair, or if you do not know your keychain password, you may need to reset your keychain.
    http://support.apple.com/kb/TS1544

  • New JAVA application with data from SAP CRM and R/3

    Hi All,
    We have a requirement to create a new application which will have CRM BP Master data and D&B Data from R/3 and based on authorization different roles be able to edit some of the fields and workflows to confirm the new data .Once users edit the fields in the application the new data will be replicated back into BP Master Data in CRM.
    In our company we are using CRM 7.0 and R/3 4.7 system if we decided to create the application using JAVA can you please let me know the architecture(servers etc) we might need because of the JAVA application.
    How to connect Java application to SAP CRM 7.0. Can you please guide me the data flow structure
    I am not sure if this is the right forum if not please suggest appropriate forum.
    Thanks a lot ,
    Kitcha.

    Hi,
    You can connect to SAP Systems by consuming the RFCs.
    you can use the JCO API to connect to R/3. the [documentation |http://help.sap.com/saphelp_nw04/helpdata/en/6f/1bd5c6a85b11d6b28500508b5d5211/content.htm]
    alternatively  you can use SAP Enterprise Connector to generate JCO Proxies : [The Documentation|http://help.sap.com/saphelp_nw04/helpdata/EN/ed/897483ea5011d6b2e800508b6b8a93/frameset.htm]
    and somr more helps:
    http://help.sap.com/saphelp_nw04/helpdata/en/89/8a185c148e4f6582560a8d809210b4/frameset.htm
    Regards,
    Naga

Maybe you are looking for