首页 \ 问答 \ 隐藏除.rdlc vs2010中最后一行之外的组中的重复项(hide duplicates in a group except last row in .rdlc vs2010)

隐藏除.rdlc vs2010中最后一行之外的组中的重复项(hide duplicates in a group except last row in .rdlc vs2010)

我正在使用.rdls vs2010报告。 有一个组“Group1”。 我正在为这个组使用HideDuplicates。 HideDuplicates隐藏除第一行外的所有内容。 但我想隐藏最后一排。

有什么建议吗?


I am working in a .rdls vs2010 report. There is a group "Group1". I am using HideDuplicates for this group. HideDuplicates hide all but first row. But i would like to hide all but last row.

Any suggestion?


原文:https://stackoverflow.com/questions/17231364
更新时间:2022-01-29 09:01

最满意答案

您必须使用Json解析器。 请找到ServiceHandler,它处理对您的服务器的get / post请求。

ServiceHandler.java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.List;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.CoreProtocolPNames;
import org.apache.http.params.HttpParams;

import android.util.Log;

public class ServiceHandler {

    static InputStream is = null;
    static String response = null;
    public final static int GET = 1;
    public final static int POST = 2;

    public ServiceHandler() {

    }

    /*
     * Making service call
     * @url - url to make request
     * @method - http request method
     * */
    public String makeServiceCall(String url, int method) {
        return this.makeServiceCall(url, method, null);
    }

    /*
     * Making service call
     * @url - url to make request
     * @method - http request method
     * @params - http request params
     * */
    public String makeServiceCall(String url, int method,
            List<NameValuePair> params) {
        try {
            // http client

            HttpParams paramsH = new BasicHttpParams();
            paramsH.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
            HttpClient httpClient = new DefaultHttpClient(paramsH);

            //DefaultHttpClient httpClient = new DefaultHttpClient();
            HttpEntity httpEntity = null;
            HttpResponse httpResponse = null;

            // Checking http request method type
            if (method == POST) {
                HttpPost httpPost = new HttpPost(url);
                // adding post params
                if (params != null) {
                    httpPost.setEntity(new UrlEncodedFormEntity(params));
                }

                httpResponse = httpClient.execute(httpPost);

            } else if (method == GET) {
                // appending params to url
                if (params != null) {
                    String paramString = URLEncodedUtils
                            .format(params, "utf-8");
                    url += "?" + paramString;
                }
                HttpGet httpGet = new HttpGet(url);

                httpResponse = httpClient.execute(httpGet);

            }
            httpEntity = httpResponse.getEntity();
            is = httpEntity.getContent();

        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(
                    is, "UTF-8"), 8);
            StringBuilder sb = new StringBuilder();
            String line = null;
            while ((line = reader.readLine()) != null) {
                sb.append(line + "\n");
            }
            is.close();
            response = sb.toString();
        } catch (Exception e) {
            Log.e("Buffer Error", "Error: " + e.toString());
        }

        return response;

    }
}

在youractivity.java中,像这样调用它

String resulting_json = null;
List<NameValuePair> params = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("id", "12345"));
nameValuePairs.add(new BasicNameValuePair("stringdata", "Hi"));
ServiceHandler jsonParser = new ServiceHandler();
String URL = "http://domain.tld/post.php";
resulting_json = jsonParser.makeServiceCall(URL, ServiceHandler.POST, params);
Toast.makeText(youractivity.this, resulting_json, Toast.LENGTH_LONG).show();

You must use a Json parser. Please find the ServiceHandler which handles get/post requests to your server.

ServiceHandler.java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.List;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.CoreProtocolPNames;
import org.apache.http.params.HttpParams;

import android.util.Log;

public class ServiceHandler {

    static InputStream is = null;
    static String response = null;
    public final static int GET = 1;
    public final static int POST = 2;

    public ServiceHandler() {

    }

    /*
     * Making service call
     * @url - url to make request
     * @method - http request method
     * */
    public String makeServiceCall(String url, int method) {
        return this.makeServiceCall(url, method, null);
    }

    /*
     * Making service call
     * @url - url to make request
     * @method - http request method
     * @params - http request params
     * */
    public String makeServiceCall(String url, int method,
            List<NameValuePair> params) {
        try {
            // http client

            HttpParams paramsH = new BasicHttpParams();
            paramsH.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
            HttpClient httpClient = new DefaultHttpClient(paramsH);

            //DefaultHttpClient httpClient = new DefaultHttpClient();
            HttpEntity httpEntity = null;
            HttpResponse httpResponse = null;

            // Checking http request method type
            if (method == POST) {
                HttpPost httpPost = new HttpPost(url);
                // adding post params
                if (params != null) {
                    httpPost.setEntity(new UrlEncodedFormEntity(params));
                }

                httpResponse = httpClient.execute(httpPost);

            } else if (method == GET) {
                // appending params to url
                if (params != null) {
                    String paramString = URLEncodedUtils
                            .format(params, "utf-8");
                    url += "?" + paramString;
                }
                HttpGet httpGet = new HttpGet(url);

                httpResponse = httpClient.execute(httpGet);

            }
            httpEntity = httpResponse.getEntity();
            is = httpEntity.getContent();

        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(
                    is, "UTF-8"), 8);
            StringBuilder sb = new StringBuilder();
            String line = null;
            while ((line = reader.readLine()) != null) {
                sb.append(line + "\n");
            }
            is.close();
            response = sb.toString();
        } catch (Exception e) {
            Log.e("Buffer Error", "Error: " + e.toString());
        }

        return response;

    }
}

In youractivity.java, Call it like this

String resulting_json = null;
List<NameValuePair> params = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("id", "12345"));
nameValuePairs.add(new BasicNameValuePair("stringdata", "Hi"));
ServiceHandler jsonParser = new ServiceHandler();
String URL = "http://domain.tld/post.php";
resulting_json = jsonParser.makeServiceCall(URL, ServiceHandler.POST, params);
Toast.makeText(youractivity.this, resulting_json, Toast.LENGTH_LONG).show();

相关问答

更多
  • 我相信错误就在这里 Log.i("log_tag","id_kepadatan: "+json_data.getInt("id_kepadatan")+ ", username: "+json_data.getString("username")+ ", nama_jalan: "+json_data.getString("nama_jalan")+ ...
  • 我认为它是因为你正在使用 final JSONArray informationArray = json.getJSONArray("student"); 尝试使用 final String informationArray = json.getString("student"); 我建议你使用Gson来解析Json并避免使用“Thread”,而应该使用“AsyncTask” I think its because you ar using final JSONArray informationArra ...
  • 因为$decoded是一个数组,所以使用循环将其写入文件或将编码的JSON写入文件( $json )。 试试这个: fwrite('tmp.json', print_r($decoded, TRUE)); 要么: file_put_contents('tmp.json', print_r($decoded, TRUE)); 更新(根据您的意见): 如果你运行print_r($decoded)并且它什么都没打印,那么传入的JSON对象的解码过程就会出现问题。我建议检查一下以确保它格式正确。 JSON格式是 ...
  • 您必须使用Json解析器。 请找到ServiceHandler,它处理对您的服务器的get / post请求。 ServiceHandler.java import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.ut ...
  • 下面是我如何做这样的事情的一个例子: HttpClient httpClient = new DefaultHttpClient(); HttpPost postRequest = new HttpPost("http://divisi.co.uk/rest/requesthandler.php"); MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); reqEntity.addPar ...
  • 将您的代码更改为 JSONObject parent = new JSONObject(); JSONArray child = new JSONArray(); child.put({ "1", "first data" }); child.put({ "2", "second data" }); 但我更有可能将您的数据存储为数组中的对象,每个对象都是一个插入数据库的对象。 JSONObject parent = new JSONObject(); JSONArray child = new JSONA ...
  • 我相信你的问题依赖于你如何调用你的php文件(在这种情况下, getJSON )来执行GET请求,这就是你的$_POST数组为空的原因。 出于调试目的,在php脚本中,试试这个: var_dump($_GET); 并检查你是否得到任何东西。 我很确定以下行: String result = Config.getJSON(Config.MyUrl + "test4.php", nameValuePair, 1000); 是空响应的根本原因。 您应该尝试对脚本执行POST请求,或者通过$_GET方法在脚本中 ...
  • JSON.stringify返回编码的字符串。 您必须发布其返回的值,而不是传递给它的参数。 // convert object to JSON json = JSON.stringify(tableObject); //now call ajax to pass info to php $.ajax({ url: 'php/ProcessOrder.php', data: {my_json_data: json}, type: 'POST', async: false, dataTyp ...
  • 这取决于您希望如何将数据传递给PHP脚本。 如果要将JSON作为字符串放在一个变量中(可能还有其他变量),那么就不应该使用内容类型“application / json”。 如果您只想发布没有任何变量的JSON,您可以执行以下操作: HttpPost httppost = new HttpPost(url); JSONObject j = new JSONObject(); j.put("name","name "); httppost.setEntity(new StringEntity(j.toStri ...
  • 好! 我终于找到了错误! 实际上,我写的代码没问题,只是它没有执行Json部分,因为它没有被finally包围! 为了使它工作,我最终修改了代码的最后一部分,如下所示: finally { //See the Answer in LogCat BufferedReader in = new BufferedReader( new InputStreamReader(conn.getInputStream())); String ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。