PDA

View Full Version : مشکل در مرتب سازی



M.Dalvand
سه شنبه 04 مهر 1385, 14:21 عصر
من یک store procedure دارم که هنگام exec کردن آن درست مرتب سازی می کند ولی وقتی آن را به کریستال وصل می کنم درست عمل نمی کند . در کریستال group دارم که وقتی آن را برمی دارم این مرتب سازی هم درست عمل می کند . در این مورد به من کمک کنید که چگونه می توانم هم group داشته باشم و هم مرتب سازی درست . در واقع مشکل کار من کجاست و چگونه حل می شود ؟
متشکرم .....

ir_ali_s
جمعه 07 مهر 1385, 09:18 صبح
سلام
خوب در sp تون group by بزارین
--------------------
در crystall به قسمت expert sort برید میتونید بر حسب هر فیلدی که خواستید مرتب سازی را انجام دهید

ir_ali_s
جمعه 07 مهر 1385, 09:23 صبح
البته شاید منظورتون این باشه که چطوری میشه با فورمول نویسی میشه در crystall مرتب سازی داشته باشیم که با عرض شرمندگی اگه فهمیدید در سایت بذارید تا ما هم یاد بگیریم

Maryam_y_m
یک شنبه 09 مهر 1385, 13:39 عصر
در group ، قسمت option ، گزینه sort order را روی in original order قرار دهید مشکل شما حل میشود

reza_optical
چهارشنبه 12 مهر 1385, 23:48 عصر
من تا اونجا که فهمیدم وقتی gorup رو ور میدارید sort درست میشه خوب بله چون کریستال بر حسب فیلدی که شما اون رو gorup by کردین sort میکنه وقابل پاک هم نست

sm
دوشنبه 31 اردیبهشت 1386, 13:52 عصر
البته شاید منظورتون این باشه که چطوری میشه با فورمول نویسی میشه در crystall مرتب سازی داشته باشیم که با عرض شرمندگی اگه فهمیدید در سایت بذارید تا ما هم یاد بگیریم

این راه حل برای C#، یکی از دوستان VB رو تبدیل کنه و بزاره اینجا:


You might have come across this requirement where you need to sort the columns in crystal report at runtime (programmatically). Consider this scenario where your crystal report has 4 fields and you have a dropdown with these 4 field names. When you select the field name in dropdown, your crystal report should get sorted with respect to the field name. You can accomplish this with few lines of code.

Check out these few lines of code:

ReportDocument objReport = new ReportDocument();
objReport.Load("Your report path");
FieldDefinition FieldDef;
FieldDef = objReport .Database.Tables[0].Fields[sortField];
objReport.DataDefinition.SortFields[0].Field = FieldDef;
objReport.DataDefinition.SortFields[0].SortDirection = CrystalDecisions.Shared.SortDirection.DescendingOr der;

Create an object of ReportDocument.Use the load method of ReportDocumnet to load a new report. If the report is already loaded, then it is closed and new one is opened.By default the report is opened as a temporary copy.Now create an object of CrystalDecisions.CrystalReports.Engine.FieldDefini tion class.

Assign rdReport.Database.Tables[0].Fields[sortField] to FieldDefinition object. Here sortField is the field name which you have selected using dropdown for sorting. Assign FieldDef to ReportDocument object (objReport.DataDefinition.SortFields[0].Field = FieldDef). Now set the direction of sorting.You have 4 types of sorting direction:

1) AscendingOrder
2) BottomNOrder
3) DescendingOrder
4) TopNOrder

Then bind your crystalreport viewer to report document.


موفق باشید