XQuery is a query language that is designed to query collection of XML data. XQUERY provides a interface to manipulate data from XML or any other data source(relational). No doubt XQUERY is the faster interface to extract data from XML, as compared to read XML in dataest and read it. Reading XML data in dataset becomes pathetic when there is a huge amount of data in the XML file. Inspite of the above fact, XQUERY is still not so much popular among developers. I tried to search GROUP BY statement in the XQUERY, I didn’t find a single clue to perform it. Following is the Stored Procedure I had converted into XQUERY, and produce a GROUP BY and ORDER BY clauses with the loops & datset. SQL STORED PROCEDURE:
SELECT
Name,sum(Qty) as TotalQty FROM Customer
WHERE CustOrderID = @CustOrderID
GROUP BY Name
ORDER BY Name
Here I would get the Various Names of customer with their SUm of product Quantity.
Now, To convert the same in XQUERY I used the following Code:
VB.NET:
Dim dsCAQuanity As New DataSet()
Dim dsTemp As New DataSet
Dim dsCKT As New DataSet
Dim dtCKT As New DataTable
Dim drCKT As DataRow
Dim dcCkt(0) As DataColumn
dcCkt(0) = New DataColumn(“Name”, GetType(String))
dtCKT.Columns.Add(dcCkt(0))
dtCKT.PrimaryKey = dcCkt
dtCKT.Columns.Add(“TotalQty”, GetType(String))
query = “(document(“”Doc”")//Table)[CustOrderID=""" & CustOrderID & """ ]“
dsCKT = xmlXqury.ReadXMLFile(“C:\XMLDatabase\Customer\”, query)
For Each rowCkt As DataRow In dsCKT.Tables(0).Rows
query =
“LET $doc := (document(“”Doc”")//Table)[Name='" & rowCkt("Name") & "' and CustOrderID=""" & CustOrderID & """ ] return { sum($doc/Qty)} “
dsTemp =
New DataSet
dsTemp = xmlXqury.ReadXMLFile(“C:\XMLDatabase\Customer\”, query)
If dsTemp.Tables.Count > 0 Then
If dsTemp.Tables(0).Rows.Count > 0 And dtCKT.Rows.IndexOf(dtCKT.Rows.Find(rowCkt(“Name”).ToString)) < 0 Then
drCKT = dtCKT.NewRow
drCKT(
“Name”) = rowCkt(“Name”)
drCKT(
“TotalQty”) = dsTemp.Tables(0).Rows(0)(0)
dtCKT.Rows.Add(drCKT)
End If
End If
Next
dsCAQuanity =
New DataSet()
dsCAQuanity.Tables.Add(dtCKT)
C#:
DataSet dsCAQuanity = new DataSet();
DataSet dsTemp = new DataSet();
DataSet dsCKT = new DataSet();
DataTable dtCKT = new DataTable();
DataRow drCKT = default(DataRow);
DataColumn[] dcCkt = new DataColumn[1];
dcCkt(0) = new DataColumn(“Name”, typeof(string));
dtCKT.Columns.Add(dcCkt(0));
dtCKT.PrimaryKey = dcCkt;
dtCKT.Columns.Add(“TotalQty”, typeof(string));
query = “(document(\”Doc\”)//Table)[CustOrderID=\"" + CustOrderID + "\" ]“;
dsCKT = xmlXqury.ReadXMLFile(“C:\\XMLDatabase\\Customer\\”, query);
foreach (DataRow rowCkt in dsCKT.Tables(0).Rows) {
query = “LET $doc := (document(\”Doc\”)//Table)[Name='" + rowCkt("Name") + "' and CustOrderID=\"" + CustOrderID + "\" ] return { sum($doc/Qty)} “;
dsTemp = new DataSet();
dsTemp = xmlXqury.ReadXMLFile(“C:\\XMLDatabase\\Customer\\”, query);
if (dsTemp.Tables.Count > 0) {
if (dsTemp.Tables(0).Rows.Count > 0 & dtCKT.Rows.IndexOf(dtCKT.Rows.Find(rowCkt(“Name”).ToString)) < 0) {
drCKT = dtCKT.NewRow;
drCKT(“Name”) = rowCkt(“Name”);
drCKT(“TotalQty”) = dsTemp.Tables(0).Rows(0)(0);
dtCKT.Rows.Add(drCKT);
}
}
}
dsCAQuanity = new DataSet();
dsCAQuanity.Tables.Add(dtCKT);
The data set dsCAQuanity will return the same record as given by the above stored procedure, means it will reterive the record with GROUP BY and ORDER BY clause.
Hope it will sort out your illusion for XQUERY group BY & order by statement. XQUERY provides Order by clause, whcih can also be used with different aspects.
Happy Coding.
DirecTV, which happens to be one of the leading satellite TV providers in the United States, has been in the news recently for all the wrong reasons. Amid thousands of complaints from across 50 states in the US, the satellite provider has been asked to shell out million as damages for its remarkably deceptive practices.
One of Americas largest satellite TV providers DirecTV has reached a mutual settlement with all the 50 states and the District of Columbia regarding allegations that the company misled consumers about its pricing and policies.
Among the many complaints filed against DirecTV are that they didn’t clearly reveal the limitations on certain pricing plans, that customers were enrolled in additional contracts without the terms being clearly unveiled to them, renewing customers in seasonal sports packages like Sunday Ticket without informing them, and duping customers on fake “cash back” offers when it was really just credit on their DirecTV bill.
In addition to the .25 million that will be paid to the states, Wisconsin Attorney General A.G. Van Hollen tells Consumerist that some of the stipulations in the settlement include many clauses. The clauses state a number of key guidelines for DirecTV to follow. DirecTV must clearly disclose all material terms and conditions to consumers without concealing anything. It must replace leased equipment that is defective at no cost except shipping costs. Many consumers had reported that DirecTV was charging them for replacing defective equipment even when under warranty. The satellite provider must also ensure that the consumer is not made to enter into any additional contract when simple replacement of the defective equipment is done. directv must clearly state what contracts the consumer might be entering into, instead of hiding it from the consumer and then informing him or her later. Because many customers alleged that their sports packages were renewed without their consent, DirecTV must now notify consumers before a consumer is obligated to pay for a seasonal sports package. The company should not falsely represent that a consumer would get cash back if the consumer would actually get a bill credit.
Many consumers had reported that they were charged cancellation fees that they had not been made aware of earlier. Also, they had similarly been charged equipment fees without been notified beforehand. DirecTV must now clearly notify consumers that they will be charged a cancellation or equipment fee at least 10 days before charging the fee. A DirecTV tells representative stated that the company is taking this settlement seriously and that DirecTV was seriously just about to do all this stuff anyway. It claims that their company was already in the process of resolving many of the consumer complaints by introducing new consumer-friendly practices.
There are many sources where you can file a first time credit card application. These include banks, credit companies and other agencies. The Internet is the easiest way to locate your preferred credit card company.
When applying for a credit card, most companies need information such as name, age, address, social security number, any former address of yours, occupation, employer, and annual household income. These details are adequate for the credit company to verify your credit history, which is the major criterion for approval or rejection. Annual percentage rate (APR) often varies with your credit score. That is, a high score will get you a low APR.
Most first credit card application forms contain certain clauses written in fine print. Company salesmen are often outspoken about the advantages of their transactions. But these fine prints often carry conditions that are disadvantageous to you. One important thing to check is the APR. Most credit companies tempt you with a low initial APR score. Remember that it is the long term APR you should weigh most, not the short term.
A US citizen who is 18 years of age or older (the limit is lower in some states) has the legal right to demand a credit card with any US bank. Generally, credit card providers do not want a bank account to get a card. It is also possible to request many credit cards at a time. But multiple applications can affect the credit score negatively.
With great competition existing in the credit card market, most credit card providers look for an easy means to attract new businesses. They provide special gifts on many occasions such as Christmas and holiday shopping seasons.
The recorded statement is a guarantee step in the claim investigation process.
Insurance adjusters will be calling you to ask if they can take your statement about the accident. Many people believe that they have to give these statements so the insurance company provides coverage for the loss. Most insurance companies have Cooperation Clauses in them, but none of them can require you to give a recorded statement in the event of a car accident.
You have the constitutional right to remain silent and to not testify against your own person. Even in murder trials, the right to no self incrimination is respected. The concept carries over to car accidents. No one can bound coverage and require you to be in a recording giving testimony of facts.
Taking a recorded statement is entirely voluntary. Do not let the insurance company tell you otherwise. If they tell you that the cooperation clause in your policy says that you must cooperate, then you can tell them that you will cooperate by giving a verbal statement (same statement just not recorded).
The cooperation clause is just that, a clause that requires you to help the insurance company’s investigation. It does not say that you have to do it under a recorded statement. If they are too pushy, then ask them to put their requirements on writing and verify what they are telling you against your actual policy.
Benefits v. Harms of a Recorded Statement
The benefit is that your insurance company will be able to better document your file. If there is a dispute about fault, and your case goes to arbitration, the arbitrator will probably look at a file with a recorded statement as having better evidence than a file without one. I have seen arbitrators decide that one person’s version of events was “more convincing” because she/he was willing to put their words in a recording.
The harms of giving a “bad recorded statement “could be many, delay in the investigation for something that you said that could bar coverage, complete denial of coverage, fault being construed against you, interpretation of your words against you, etc.
If you think that giving a recorded statement is the right thing to do, then consider only giving it to your own insurance company. If the other party’s insurance carrier asks for a recorded statement, have them contact your insurance company and “share” a copy of the tape. This way you only give one statement, and the people questioning you is your own insurance company (the one protecting your interests).
Here are the best 10 tips of what you should do before you give a recorded statement:
1. Make sure you have time to talk. Secure at least one hour of your time.
2. Make sure is time that work s for you and the adjuster’s. Do not do it before the adjuster’s lunch time. They will rush you to get out of the tape without giving you a chance to fully explain your point of view.
3. Have all the information available in front of you. For example, Names, streets, insurance polices, and the police report if possible.
4. Read your police before hand. This way you will know why the adjuster is asking what they are asking, and see if they are trying to find information to deny your claim.
5. Tell the adjuster that you are willing to give the statement only if they give you a transcription of what you said. Make sure you say this on the tape.
6. Remember that you can decline to answer any question for any reason at anytime. Just say it. I decline to answer for personal reasons.
7. Tell the adjuster that you will also record the conversation. This usually puts them in their best behavior.
8. Answer only what they asked you. If the question is what color is the light? then answer should be a color and nothing more.
9. If the question is subjective, decline to answer, tell them that you do not know, or simply just ask the adjuster what they are looking for specifically.
10. Be polite and respectful. If they are rude or anxious, the adjuster’s supervisor will probably side you. But if you are rude, your complaint will be dismissed.
Drive safe and hope that others will!
Step I – Selecting A Collection Agency
Selecting a credit collection agency is perhaps the most important and difficult task. Some factors you must consider while selecting a collection agency are:
- Experience and professionals
- Geographical presence
- Expertise
- Fees and charging model
- Customer references
- Collection Agency Services has covered this topic in depth through various free collections reports and articles on this site.
Step II – Hiring the Collection Agency and Setting Up Processes
Once you select the collection agency, the first two steps you have to take are:
Enter into a contract with the agency;
Set up processes on how you are going to communicate with the agency.
A contract is the legal document and your legal experts will, of course, prepare it correctly. Just make sure that you include important clauses such as confidentiality and non-disclosure. You are likely to pass sensitive information to the collection agency such as your account receivables, customer contacts, product and services pricing, etc. to facilitate faster debt collection. You want to be sure that this information does not fall in the wrong hands.
Setting up processes is a very important step in dealing with the collection agency. The success or failure of your partnership will depend a lot on how well-defined your processes are and how strictly they are followed. Important processes you need to define are:
Internal processes: You have to put in place a clear process on defining bad debt and referring the case to the collection agency. You don’t want to refer the case to the collection agency before you make a sincere effort to collect the dues internally.
Information transfer: How will you transfer the information to the collection agency about your dues and defaulting customers, and how will you receive the information from your collection agency? Debt collection software can make the information transfer process easy and secured.
Third party dealing: As mentioned earlier, it is very important for you to ensure the security of the information you give to the collection agency. The collection agency may use one or more of its associated agencies to get information about defaulting customers. Hence you need to set up a clear protocol on how much information they can share with such third parties.
Communication: You need to set up single point contacts for communication within the company and the collection agency. In debt collection practices, the timing of communication is extremely important and hence it will go a long way in deciding the success of your debt collection process. Again, the importance of debt collection software cannot be overemphasized here.
Step III – Performance Monitoring
Once all processes are set, start monitoring the performance of the collection agency. This is an ongoing process when dealing with a collection agency. Important parameters to monitor are:
Quantitative
- Number of cases referred to the credit collection agency and percentage of cases successfully solved by them.
- Percentage of debt recovered by the collection agency from all cases referred.
- Percentage of debt recovered by the collection agency from solved cases.
- Percentage of amount paid as fees/commission to the collection agency to the total bad debt cases referred to them.
- Average number of days taken by the collection agency for full/partial credit collection.
Qualitative
* How well do the collection agency professionals deal with your customers?
* Has the collection agency followed all legal requirements mentioned in the Fair Debt Collection Practices Act?
* Has the collection agency gone beyond the provisions of the Fair Debt Collection Practices Act?
* Has the collection agency followed all processes and guidelines set by you?
Step IV – Contract Closure
Hopefully, the selected collection agency will work best for you. But if it doesn’t, then you need to transfer all your debt collection processes from the agency. You should remember the following important points when you are ending the contract:
Confidentiality and non-disclosure clauses are applicable even after the end of the contract with the collection agency as well as its employees. The collection agency returns all documents related to your business and destroys all information related to your business from their data storage.
Following these simple guidelines will ensure that when dealing with a collection agency that it works best for you and your bad debts are minimized.
