AyaNova service management & work order software
AyaNova Support Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Sql query Expand / Collapse
Author
Message
Posted 3/4/2008 6:59:01 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 5/21/2008 1:33:46 AM
Posts: 6, Visits: 17
I'm trying to extract information from the database using sql query. I want to calculate hours of labor in workorders which is completed but not closed.

This is what I'm starting with:

select ASERVICENUMBER, ASERVICERATEQUANTITY from dbo.AWORKORDER, dbo.AWORKORDERITEM, dbo.AWORKORDERITEMLABOR, dbo.ARATE, dbo.AWORKORDERSERVICE
where (dbo.AWORKORDERITEMLABOR.AWORKORDERITEMID=dbo.AWORKORDERITEM.AID
and dbo.AWORKORDERITEM.AWORKORDERID=dbo.AWORKORDER.AID)
and (ACLOSED = '0' and ASERVICECOMPLETED = '1')

I want to expand to select spesific type of orders, but first I have to be sure my starting point is correct. And my query is not correct... I'm not sure why. I really hope someone can give me a clue!

Post #3855
Posted 3/4/2008 10:20:49 AM
AyaNova Development & Support

AyaNova Development & SupportAyaNova Development & SupportAyaNova Development & SupportAyaNova Development & SupportAyaNova Development & SupportAyaNova Development & SupportAyaNova Development & SupportAyaNova Development & Support

Group: Administrators
Last Login: 8/7/2008 2:50:46 PM
Posts: 99, Visits: 411
Ninni (3/4/2008)
I'm trying to extract information from the database using sql query. I want to calculate hours of labor in workorders which is completed but not closed.

I want to expand to select spesific type of orders, but first I have to be sure my starting point is correct. And my query is not correct... I'm not sure why. I really hope someone can give me a clue!

Hi Ninni, we do not support or encourage people to work directly with the database under any circumstances. Over the years we have had too many incidents of people damaging their data and resulting in lost information and we get very nervous when we see people trying to work directly with the database in any manner. 

Of course a simple read only query of information isn't going to damage the data but it always seems to start with that then people feel it's safe to do anything and they start modifying data and things start to break in weird and unexpected ways that take a long time to fix if ever. 

For that reason we've invested a lot of time and effort into making and providing at no cost a full developers API in addition to the built in ability to make all manner of custom reports within AyaNova itself so that end users have two powerful options that simplify all aspects of working with their AyaNova data in a safe, simple and consistent manner.  For what you are trying to do the normal route is a custom report which can not only be printed but exported as data into other applications if necessary easily from within the report viewer built into AyaNova. 

In terms of your query, what you are attempting to do goes right to the most complex heart of the work order schema structure.  Just at a glance I can see you are mising several joins for the related tables that you are trying to get information from and also a lot more items in your WHERE criteria to (for example) filter out quotes, Preventive maintenance etc.

It's not impossible to build a query like that by any means but it is *very* complex and you need to know a quite significant amount about the internal structure of the work order and all the potential side effects of the wrong joins and criteria affecting the accuracy of the data you retrieve from it.  As long as you are simply querying and not making any updates then it's safe enough, but there are easier ways to accomplish what you want to do either via a custom report in AyaNova itself or an application that uses the developers API.

Perhaps if you can tell me the overall goal and what you are intending to accomplish I can better help you with an alternative method.

Post #3856
Posted 3/10/2008 3:53:46 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 5/21/2008 1:33:46 AM
Posts: 6, Visits: 17
My goal is to retrieve data, not to modify. I want to sum up the amount of labour from different kind of work orders. Ex. all work orders which are completed but not closed. And then sort out work orders based on criterias like type of rate, category, user and date.

From what I've seen of the custom reports, I can't get all the information I need. I am however not familiar with the tool, there might be options there that I've missed.

I will check out your developers API. It migth be valuable to us. We are also interested in exporting from Ayanova to another application, to simplify the prosedures with invoice.

Post #3868
Posted 3/10/2008 10:33:31 AM
AyaNova Development & Support

AyaNova Development & SupportAyaNova Development & SupportAyaNova Development & SupportAyaNova Development & SupportAyaNova Development & SupportAyaNova Development & SupportAyaNova Development & SupportAyaNova Development & Support

Group: Administrators
Last Login: 8/7/2008 2:50:46 PM
Posts: 99, Visits: 411
Bianca (3/10/2008)
My goal is to retrieve data, not to modify. I want to sum up the amount of labour from different kind of work orders. Ex. all work orders which are completed but not closed. And then sort out work orders based on criterias like type of rate, category, user and date.

From what I've seen of the custom reports, I can't get all the information I need. I am however not familiar with the tool, there might be options there that I've missed.

I will check out your developers API. It migth be valuable to us. We are also interested in exporting from Ayanova to another application, to simplify the prosedures with invoice.

 

Hi Bianca (you changed your name?  I looked at my last reply and thought "where did I get Ninni from?" then saw that was the original name.   ),

You should check with regular support about the report you want because I'm fairly certain you *can* get that information as you want it, what you describe is fairly common although everyone has their own format they want to use, note that the reports also support full scripting in C# behind them making for some very complex reports if necessary and the big advantage is that once a report is created how you like it in AyaNova then anyone can use it any time from within the program without having to know anything complex to do it.

Also you can very easily export from a report to (for example) Excel or Access for further analysis so as long as the information you need is on the report it can be easily exported out to another program without resorting to a complex query, just set up your conditions within the grid filters in AyaNova itself and print.

I don't support reporting here in the developers API forum, but regular tech support will be happy to help you out with that, they're the experts on that side of it.  Drop them a line explaining what you want to do in detail or post it in the dedicated reporting forum here -> http://forum.ayanova.com/Forum100-1.aspx

If you are intending on exporting from AyaNova for invoicing the developers API is ideal, it's what was used to build the QuickBooks and PeachTree (as well as AyaNova itself) add on programs which involve invoicing work orders, synching parts, customers, vendors etc so if you are integrating with another application you won't find an easier way to do it.

Post #3869
Posted 3/11/2008 8:21:31 AM
AyaNova Sales & Support

AyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & Support

Group: Administrators
Last Login: Yesterday @ 10:10:22 AM
Posts: 1,797, Visits: 4,166
For the benefit of other AyaNova users reviewing this post, another member of the company contacted support directly regarding the above but instead of via SQL query, how to get the data to a CSV file from a report, and I wanted to post here a link to the AyaNova Support Forum topic so that others can also refer to it as needed

http://forum.ayanova.com/Topic3872-103-1.aspx

- Joyce

AyaNova Sales & Technical Support
http://www.ayanova.com
Post #3873
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: AyaNova Sales & Support, John

Permissions Expand / Collapse

All times are GMT -8:00, Time now is 6:27pm

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.078. 10 queries. Compression Disabled.