This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello, have you an example of how link crystal report to LightSpeed? Do you know a best program to interact with LightSpeed? |
|
|
Hi Antonio, In the beginning I also had problems interfacing Crystal Reports with LS. After much searching and trial and error, the solution I finally found that worked, was as follows. 1. In the same module as where you will edit the rpt files in Visual Studio, create a class. A sample of this class can be found in the Crystal reports file called VS2005_Walkthroughs.pdf. 2. From within the Crystal Report designer, select a datasource of type .Net Objects, and locate the class you made earlier. This will enable you to layout your report. 3. Then at runtime, I use the LINQ to Lightspeed to create the data I need, and cast the output to the class created earlier. i.e. var ops = from p in uow.POHeaders join r in uow.PORows join on p.Id equals r.POHeaderId select new ReportClass { PONumber = p.NoNumber, PODate = p.Date }; var pos = ops.ToArray(); _rpt.SetDataSource(rpt);
Where rpt is the report object, and ReportClass is the class you made in step 1. I know it is a bit long winded, and if anyone has a short cut I would love to hear it, but this definitely works, have used it for about 30 reports already.
|
|
|
Sorry, but I don't understand.. I use CR integrated in VS 2008. Is the same? Can you attach a simple example?
Thank you very much |
|
|
I also use VS2008, so yes this works in VS2008. I referred to the VS2005 document, because a) it is still valid, and b) I can't find a VS2008 version. ;-) I have attached a small project, I have kept it very simple, and for legal reasons removed all the binaries. But if you check the .cs files, along with what I sent previously, you should be able to work it out. Good luck. PS. I have put the LS classes into a separate file as that is the way we do it, and I presume, so do most others. PPS. If anyone has a better way to do this I would love to hear about it. |
|
|
I have an error when I try to execute this command: var pos = ops.ToArray(); The error says: |
|
|
Dear Antonio, Whilst the mentioned line throws the error, the problem is most probably in your definition of ops. As it is the ops.ToArray() that actually executes the LINQ previously defined in ops. I suggest you double check your LINQ statement first, if that desn't resolve the problem, you can try to use LINQPad with the LINQPad To Lightspeed drivers, to test your LINQ statement. If your LINQ works correctly in LINQPad, it maybe that you are trying to use a LINQ function that is not supported by Lightspeed. But I would strongly suggest you check your LINQ first. I have received this message a numebr of times, and each time it was a typo on my behalf that resulted in it. Hope this helps. Mark |
|
|
Hello Mark, I have tested my LINQ in LinqPAD and I have same error, I understand where is error and now I try to resolve it. This is my LINQ : from oT in OfferteTs And the error shoud be when I do join on multiple fields (on new {oT.Offernunroff, oT.Offerdadtoff}), because if I do join on a single field, all works fine. Thank you for help! |
|
|
Hi Antonio, When you said the LINQ also failed in LINQPad, was that using the LINQ to Lightspeed connection drivers or using the "out of the box" SQL connection? Please try with both, the results would help to narrow down if the problem is with the LINQ, which at first glance I don't see a problem with, or with the Lightspeed parsing. Thanks |
|
|
Hi Mark, I use the LINQ to LS connection drivers. I don't understand because don't works. |
|
|
Ok, try to use the LINQPad's "built-in" "LINQ To SQL" to create a connection to your database, then try the LINQ statement again, if this also fails, then the problem is with your LINQ, if this works, then it may be a limitation of the LINQ to Lightspeed parser. |
|
|
hi, where could I find this file? thanks VS2005_Walkthroughs.pdf. |
|
|
You can just search the internet for it, alternatively, use this link http://www.businessobjects.com/global/pdf/devzone/VS2005Walkthroughs.pdf |
|
|
hi, thanks for the reply. I'm still having a weird problem. I've seen the class i made but when i use it as my data source in my report designer it doesn't show any fields any suggestions sir? thanks |
|
|
Crystal reports seems a little sensitive where the class is located. Initially I tried to locate it in the same namespace and dll as my model. It did not seem to like this. So I put the class into the UI namespace and dll, and I then could see the classes. Also, make sure you build the dll with the class, else it can not be used. |
|