SSRS 2017怪异行为与水平轴上自定义标签文本的柱形图

时间:2018-10-14 12:42:36

标签: reporting-services ssrs-2017

我在使用SSRS 2017柱形图时遇到奇怪的行为。请参阅以下方案和为此提供的sql脚本。

SSRS图表类型-列

类别组-ReportType,标签上的组-ReportCustomText

水平轴选项

轴类型-类别和其他默认选项

系列组

     Group 1 = ReportType - Group on ReportType, Label - ReportCustomText
     Group 2 = EntityName - Group on EntityName, Label - EntityName 

系列值-

     Value Field - EntityValue
     CategoryField - ReportCustomText

水平轴属性保留为默认设置。在此报告中,我在x轴上最多有三个数据点。 SSRS仅在以下情况下显示奇怪的值。

三个数据点

ReportType=1 Custom Label Text = 0 - 10
ReportType=2 Custom Label Text = 11 - 20
ReportType=3 Custom Label Text = 21 - 31

只要我们只有第二个数据点的值(即报告类型= 2),SSRS图表就会显示随机数据值,而不是指定的标签文本。如果我们具有报告类型值为1或2的数据点,则它可以正常工作。

这似乎是SSRS 2017中引入的错误,但是如果您可以看一下这个问题,我将不胜感激。

SQL示例数据

  Create Table #ReportResult      
  (      
   ReportType SMALLINT,      
   EntityName Varchar(64),      
   EntityValue INT,  
   EffectiveMonth varchar(32),
   ReportSeriesCount TINYINT,
   ReportTypeCount SMALLINT,
   ReportTypeRank TINYINT,
   ReportCustomText varchar(32)

  )    

   Insert Into #ReportResult (ReportType,EntityName,EntityValue,EffectiveMonth,ReportCustomText) Values
   (2,'Report Rule - 11',   12, NULL,'11 - 20'),
(2,'Report Rule - 22',  11, NULL,'11 - 20'), 
(2,'Report Rule - 33',  5,  NULL,'11 - 20') 

SELECT * FROM #ReportResult

DROP TABLE #ReportResult

图表的屏幕截图

enter image description here

1 个答案:

答案 0 :(得分:0)

检查水平Axis属性。

如果将“轴类型”更改为package com.instdownload; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.os.AsyncTask; import android.os.Environment; import android.os.IBinder; import android.support.annotation.Nullable; import android.support.v4.app.NotificationCompat; import android.util.Log; import android.widget.Toast; import java.io.BufferedInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; import java.net.URLConnection; import java.util.HashMap; public class DownloadService extends Service { File VideoDirectory, file; String appname, video_fname; NotificationManager mNotificationManager; HashMap<Integer, NotificationCompat.Builder> notificationHashMap = new HashMap<>(); URLConnection conection; InputStream input; OutputStream output; int lenghtOfFile; Boolean Iscancelled = false; DownloadFileFromURL download; public static final String A3 = "679f46b"; private final BroadcastReceiver cancel_download = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { try { if (download.getStatus() == AsyncTask.Status.RUNNING) { download.cancel(true); } File file = new File(Environment.getExternalStorageDirectory(), AllStaticData.RootDirectory + "/" + AllStaticData.VideoDirectory + "/"); Iscancelled = true; finishedDownload(3333); Toast.makeText(getApplicationContext(), "Download cancelled!", Toast.LENGTH_LONG).show(); } catch (Exception e) { e.printStackTrace(); Log.i("Unable", "" + e); Toast.makeText(getApplicationContext(), "Unable to stop download!", Toast.LENGTH_LONG).show(); } } }; @Nullable @Override public IBinder onBind(Intent intent) { return null; } @Override public void onCreate() { super.onCreate(); } @Override public void onStart(Intent intent, int startId) { } private String getpreferences(String key) { SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences("pref", 0); return sharedPreferences.getString(key, "0"); } private void SavePreferences(String key, String value) { SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences("pref", 0); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(key, value); editor.commit(); } @Override public int onStartCommand(Intent intent, int flags, int startId) { appname = getResources().getString(R.string.app_name); mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); registerReceiver(cancel_download, new IntentFilter("cancel_download")); try { video_fname = intent.getStringExtra("video_fname"); download = new DownloadFileFromURL(); download.execute(intent.getStringExtra("url"), video_fname); SavePreferences("video_fname", intent.getStringExtra("video_fname")); SavePreferences("url", intent.getStringExtra("url")); SavePreferences("thumb", intent.getStringExtra("thumb")); } catch (NullPointerException e) { Log.i("", "" + e); video_fname = getpreferences("video_fname"); download = new DownloadFileFromURL(); download.execute(getpreferences("url"), video_fname); } return START_STICKY; } private class DownloadFileFromURL extends AsyncTask<String, String, String> { @Override protected void onPreExecute() { super.onPreExecute(); setNotification(video_fname, "Downloading video...", 3333); } @Override protected String doInBackground(String... f_url) { int count; try { URL url = new URL(f_url[0]); conection = url.openConnection(); conection.connect(); lenghtOfFile = conection.getContentLength(); input = new BufferedInputStream(url.openStream(), 8192); VideoDirectory = new File(Environment.getExternalStorageDirectory(), AllStaticData.RootDirectory + "/" + AllStaticData.VideoDirectory + "/"); if (!VideoDirectory.exists()) { VideoDirectory.mkdirs(); } file = new File(VideoDirectory, video_fname); output = new FileOutputStream(file); byte data[] = new byte[1024]; long total = 0; while ((count = input.read(data)) != -1) { total += count; publishProgress("" + (int) ((total * 100) / lenghtOfFile)); output.write(data, 0, count); } output.flush(); output.close(); input.close(); } catch (Exception e) { Log.e("Error: ", e.getMessage()); } return null; } protected void onProgressUpdate(String... progress) { Log.i("progress", "" + progress[0]); Intent broadcast1 = new Intent("update_progress"); broadcast1.putExtra("progress", Integer.parseInt(progress[0])); broadcast1.putExtra("path", file.getAbsolutePath()); broadcast1.putExtra("thumb", getpreferences("thumb")); broadcast1.putExtra("strdata", getpreferences("url")); sendBroadcast(broadcast1); } @Override protected void onPostExecute(String file_url) { if (!Iscancelled) { Intent broadcast1 = new Intent("update_progress"); broadcast1.putExtra("progress", (int) 100); broadcast1.putExtra("path", file.getAbsolutePath()); sendBroadcast(broadcast1); finishedDownload(3333); } } } private void setNotification(String title, String content, int notifyId) { Intent notificationIntent = new Intent(getApplicationContext(), MainActivity.class); notificationIntent.setAction(Intent.ACTION_MAIN); notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER); notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent resultPendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, notificationIntent, 0); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext()); Notification notification = mBuilder .setContentTitle(title) .setContentText(content) .setContentIntent(resultPendingIntent) .setSmallIcon(android.R.drawable.stat_sys_download) .build(); notification.flags |= Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT; mNotificationManager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(9997, notification); notificationHashMap.put(notifyId, mBuilder); } private void finishedDownload(int notifyId) { try { notificationHashMap.get(notifyId).setContentText("Finished"); notificationHashMap.get(notifyId).setSmallIcon(android.R.drawable.stat_sys_download_done); mNotificationManager.notify(notifyId, notificationHashMap.get(notifyId).build()); mNotificationManager.cancel(notifyId); unregisterReceiver(cancel_download); } catch (Exception e) { Log.i("", "" + e); } Intent iii = new Intent(getApplicationContext(), DownloadService.class); stopService(iii); } @Override public void onDestroy() { mNotificationManager.cancel(9997); super.onDestroy(); } } ,则可以重现您的结果。

如果我将其保留为默认设置Scalar (Numbers/Dates),那么我将获得预期值Category