<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    JUST DO IT ~

    我只想當(dāng)個(gè)程序員

    ireport sql where List in 多個(gè)值 jasper

     

    ireport List in where  


     <parameter name="p1" class="java.util.List"/>
     <queryString language="SQL">
      <![CDATA[select * from user2 where   $X{IN, name , p1}]]>
     </queryString>


    create table user2 (
    id varchar2(3),
    name varchar2(5)
    );
    insert into user2 values('1','tom');
    insert into user2 values('1','ask');
    insert into user2 values('3','tom2');
    insert into user2 values('3','a');

     


    expression is

    new Boolean($P{p1}.add($F{your_field_from_query})

    keep the rest type as report so that all the values from the field get added into the para p1

    --> now use it in your where clause as follows:

    where $X{IN,col_name,p1}


    Lee,

    I apologize! I was wrong because I mixed the two cases : string parameter and collection!

    I first tried with a collection and , as far as I remember, it worked but as I said I needed to pass the parameters through an URL.

    The $X{} parameter form needs effectively a collection.

    What I used for the string parameter is the $P!{} form (notice the !) which expands the parameter as it.

    So in your query you should try something like that :

    " where table.value in $P!{A}" if A contains the string "(1,2,3)"

    I am sure I used it and it worked. Now I am not in the environment where I can access my jasperserver so I cannot do cut and paste of the real query I used.

    As soon as I am in the good environment, I will post you more details !
                  
     Gaby38
     
    Project Roles
    Posts: 248
     

    Karma: 35
     
     
        
     
     #44638 
    RE:Issue with Parameters that are from a List 08/14/2008 17:56    
    Lee,

    I confirm my previous post. I have a report under jasperserver which is launched via URL and which has one of his parameters "I_ActList"  which is a list of "activities id" passed as a string and in my query I have in the where clause :

    "where stat.QUARTIER_Adresse.GdQuartier=$P{GdQuartier}
    and conso_jour.id_act in $P!{I_ActList}"

    THis is a copy/paste of a part of my query viewed under iReport.

    I_ActList contains a comma separated list of integers which are the ids of activity fields :

    "(6,7,8)"  for instance

    and it works.

    Hope you will success in your environment
     
     
     

     http://stage.jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=70494

     http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=44570

    org.apache.commons.lang.StringUtils.join($P{A}.toArray(),",")

    http://www.daniweb.com/forums/thread143304.html

    http://www.javalobby.org/java/forums/t43616.html

    http://www.tkk7.com/killme2008/archive/2007/02/06/98242.html
    http://jtri.sourceforge.net/en/report/ireportHibernate.html

    http://netspirit.javaeye.com/blog/144057

     

    Lee,

    I confirm my previous post. I have a report under jasperserver which is launched via URL and which has one of his parameters "I_ActList"  which is a list of "activities id" passed as a string and in my query I have in the where clause :

    "where stat.QUARTIER_Adresse.GdQuartier=$P{GdQuartier}
    and conso_jour.id_act in $P!{I_ActList}"

    THis is a copy/paste of a part of my query viewed under iReport.

    I_ActList contains a comma separated list of integers which are the ids of activity fields :

    "(6,7,8)"  for instance

    and it works.

    Hope you will success in your environment

    Gaby
                  
     Gaby38
     
    Project Roles
    Posts: 248
     

    Karma: 35
     
     
        
     
     #66426 
    RE:Issue with Parameters that are from a List 11/06/2009 11:15    
    So when i pass the parameter to the report i have to place a () before and after teh parameters 
     
     

     

     

     

    How to do multi-select in iReport 3.6 09/10/2009 19:42    
    I am trying to run a report with a multi-select parameter in iReport 3.6 but cannot get it to run. Parameter name is EmployeeType of type java.util.Collection. My default value expression is java.util.Arrays.asList(new String[]{"Manager","General"})

    select Name
    from Table1
    where $X{ IN, EmpType, EmployeeType}

    In the Report Query window, I get an error message saying:

    Error: SQL problems: Line 3: Incorrect syntax near 'X'.


    If I try using $P I get the message:

    Error: SQL problems: The Java type java.util.Arrays$ArrayList is not a supported type.


    If I try using $P! I get the message:

    Error: SQL problems: Invalid column name 'Manager, General'.

    Any ideas on how to solve this?
                  
     zamudio
     
    Project Roles
    Posts: 4
     

    Karma: 1
     
     
        
     
     #63637 
    RE:How to do multi-select in iReport 3.6 09/10/2009 20:31    
    zamudio,


    That's a bug in the "Report query" tab. Please enter a bug for it in the tracker.


    The work around is simple enough, but it's certainly annoying:
    1. Do not use "Automatically Retrieve Fields" (I hate that option anyway.)
    2. Remove the $X syntax; click Read Fields; add the $X syntax back.


    The report works fine with $X syntax (both in iReport and in JasperServer). It's only the query panel that doesn't work correctly.


    Regards,
    Matt
                  
     mdahlman
     
    Project Roles
    Posts: 790
     

    Karma: 153
     
     
        
     
     #63641 
    RE:How to do multi-select in iReport 3.6 09/10/2009 21:49    
    That works!

    One more question, how do you pass a Collection field to a dataset or a subreport?

    zamudio
                  
     zamudio
     
    Project Roles
    Posts: 4
     

    Karma: 1
     
     
        
     
     #63730 
    RE:How to do multi-select in iReport 3.6 09/12/2009 21:42    
    Found it!

    To pass a Collection parameter to a subreport or dataset enter it as the following expression:

    If your report language is Java, pass the parameter as $P{ParameterName}

    If your report language is Groovy, pass the parameter as $P{ParameterName}.toArray()

    zamudio

     

    Post Edited by zamudio at 09/12/2009 22:02               
     zamudio
     
    Project Roles
    Posts: 4
     

    Karma: 1
     
     
        
     
     #70420 
    RE:How to do multi-select in iReport 3.6 02/01/2010 17:06    
    hi there!

    i'm trying to do the same thing as zamudio but in my case, the values are Integer.

    i created a parameter called "yearsCollection" of type collection and the Default Value set to new ArrayList(Arrays.asList( new Integer[]{new Integer(2008),new Integer(2009),new Integer(2010)} ))

    i have a column in my database called "year" of type int..

    i passed the parameter value to the query like this:

    $X{ IN, year, yearsCollection}

    when i run the report and in the prompt window i click in the "Use Default" button, the reports fills correct, but when i try to set values in the prompt text field (ex: 2008,2009) it crashes and the following error appears:

    Implicit conversion from datatype 'CHAR' to 'INT' is not allowed.

    =/, i read somewhere that the jasper assumes that the values datatypes passed to the $X{ IN, year, yearCollection} are supposed in the runtime, so i don't know how to manage this issue...

     

    i also tried this way: "year IN ($P!{yearCollection})" with no success

    i'm using iReports 3.7 and JasperServer 3.7

     

    i hope someone can help me!
     
     
     

    posted on 2010-12-08 00:11 小高 閱讀(2889) 評(píng)論(1)  編輯  收藏 所屬分類: java基礎(chǔ) 、Oracle 、J2EE

    評(píng)論

    # re: ireport sql where List in 多個(gè)值 jasper 2014-12-09 11:18 lul

    test ok! thanks!
    use this "select * from table where condition in ($P!{list})"
    list like "1,2,3" or "1,2,3",the ireport can't to know they difference.  回復(fù)  更多評(píng)論   

    導(dǎo)航

    <2014年12月>
    30123456
    78910111213
    14151617181920
    21222324252627
    28293031123
    45678910

    統(tǒng)計(jì)

    常用鏈接

    留言簿(3)

    隨筆分類(352)

    收藏夾(19)

    關(guān)注的blog

    手冊(cè)

    搜索

    積分與排名

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    主站蜘蛛池模板: 麻豆国产入口在线观看免费| 免费a级毛片永久免费| 亚洲伊人久久大香线蕉在观| 最近中文字幕电影大全免费版| 777亚洲精品乱码久久久久久| 精品久久8x国产免费观看| 亚洲人AV在线无码影院观看| 免费大黄网站在线观看| 两个人看的www高清免费观看| 久久精品7亚洲午夜a| 日韩av无码成人无码免费| 国产亚洲精品仙踪林在线播放| 亚洲一区二区三区影院 | 亚洲另类自拍丝袜第五页| 国产亚洲福利一区二区免费看| 国产精品高清免费网站| 亚洲一级大黄大色毛片| 亚洲视频在线免费| 四虎永久在线观看免费网站网址| 蜜桃传媒一区二区亚洲AV| 亚洲国产女人aaa毛片在线| 国产精品四虎在线观看免费 | 亚洲欧洲自拍拍偷午夜色| 亚洲精品色婷婷在线影院| 亚洲一区二区三区免费观看| 免费国产高清毛不卡片基地| 国产成人精品日本亚洲直接| 亚洲情XO亚洲色XO无码| 免费va在线观看| 男女超爽刺激视频免费播放| 国产免费播放一区二区| 青娱乐在线视频免费观看| 亚洲日本国产综合高清| 亚洲色图黄色小说| 五月天网站亚洲小说| 区久久AAA片69亚洲| 免费一区二区三区四区五区| 成人网站免费观看| 一本无码人妻在中文字幕免费| 亚在线观看免费视频入口| 国产真人无码作爱视频免费|