隐藏除.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
最满意答案
您必须使用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 ...
-
Android PHP Json(Android PHP Json)[2023-05-25]
将您的代码更改为 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文件到PHP(post json file to PHP)[2022-06-01]
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 ...