I'm using a Access Database to pull Data and displaying using Report
In my table theirs a Column holding Commission data however every time I add
=Sum(Fields!Commission.Value) in a empty Cell to display the Sum value I get a Error.
try this:
=Sum(int(Fields!Commission.Value))
may be you are using string so first convert it into int
Sum() in SSRS requires two fields to sum up and there must be an = sign before your function..like this
=Sum(Fields!Commission.Value)
Maker sure the field is Int and not String if so convert it to integer to sum.
Related
I am trying to fill a datatable in vb using SQLiteDataAdapter from a SQLITE database. There are 3 fields in the table that contain dates and they appear as either recent dates or "1899-12-30" . The Fill command generates a "String was not recognized as a valid DateTime." error. I cannot find a date entry that does not look valid, except "1899-12-30", is this a valid date?
Any other thoughts would be appreciated.
Brad
The short answer is 'yes'. I built a table with the three possible ways of storing dates, thus:
CREATE TABLE `JustDate` ( `Date_1` INTEGER, `Date_2` TEXT, `Date_3` REAL )
Then I populated each of those fields in one record with the value you suspect.
And then I did a trial query against the fields to see if sqlite would treat them as proper dates.
I have:
<cfspreadsheet action="read" src="#Trim(PathToExcelFile)#" query="Data">
How do I count the total column in my "Data" query using ColdFusion Query of Query? I need to count whether my users has used the corrent excel file format before inserting into my DB.
I'm using Oracle 11g and I can not do:
Select * From Data Where rownum < 2
If I can do that then I can create an array and count the columns but running that script using results in error. The error saying that there is no column name Rownum. Oracle does not allow me to use select top 1.
I don't want to loop over 5000+ record to just count the total column of one row. I appreciate any help, thank you
ColdFusion adds a few additional variables to it's query results. One of them is named `columnList' and contains a comma-separated list of the query columns that were returned.
From the documentation here
From that you should be able to count the number of columns easily. #listlen(Data.columnList)# as one example.
I am working on a sort function for a table column that holds desk numbers and names.
This is a legacy program and was designed so that this column is nvarchar.
Because of this, the sort function cannot sort numerically as shown below:
Should I go into the database and alter this column to add leading zeros to number-only entries? Is this even do-able since the column is nvarchar?
Or should I add code at the object-level to add leading zeros just before the data is presented?
I would add one getter property in my class so it look like
public int Ordering
{
get
{
return int.Parse(CharColumn);
}
}
and when getting list of those objects simply order by that new property.
SQL Server is built upon SET Theory which states that, if you order your result set, you get non-relational data.
I would create another database column with the numeric value (there may be some columns that don't convert well, make sure you identify these and work to convert them). Then I would work to convert your application to use the new values. If the conversion is too great you could make sure all new development uses the new column and old code is migrated the next time someone touches it.
The risk to your approach is too fold, storing them in varchar is inefficient with both memory and processing power. Adding zeroes will help with the sorting but not fix the root issue.
Here is another question that I think will help you: SQL Server : error converting data type varchar to numeric
I have multiple data sets that drive the Pentaho report. The data is derived from a handful of stored procedures. I need to access multiple data sources within the report without using sub reports and I believe the best solution is to create open formulas. The SINGLEVALUEQUERY I believe will only return the first column or row. I need to return multiple columns.
As an example here my stored procedure which is named HEADER in Pentaho (CALL Stored_procedure_test (2014, HEADER)), returns 3 values - HEADER_1, HEADER_2, HEADER_3. I'm uncertain of the correct syntax to return all three values for the open formula. Below is what I tried but was unsuccessful.
=MULTIVALUEQUERY("HEADER";?;?)
The second parameter denotes the column that contains the result.
If you dont give a column name here, the reporting engine will simply take the first column of the result. In the case of the MULTIVALUEQUERY function, the various values of the result set are then aggregated into a array of values that is suitable to be passed into a multi-select parameter or to be used in a IN clause in a SQL data-factory.
For more details see https://www.on-reporting.com/blog/using-queries-in-formulas-in-pentaho/
I have a dataset which stores dates in a DataColumn (datatype of this column is DateTime). I need to change the format from DateTime to string that will give me the date as per my current culture.
In case of a single DateTime variable, I can use the overloaded ToString() to achieve this in the following manner:
DateTime.Now.ToString(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern)
But I need to convert data for all the rows in my DataSet to string. Does anyone have an idea on how I can achieve this?
Thanks.
When you get the DataSet:
locate apropriate DataTable
add new DataColumn
in one loop you populate new Column with (your DateTime).ToString()
Get the Dataset.
for each row convert to string and
put it in new dataset (along with
rest of data).
I don't think it's possible to change a column type after the table been filled. I think you should create a second table on your dataset and copy the information you need transforming the date in the process.
New answer :)
I have been googling an came up with this site: Linq to Dataset
That example shows how you can use linq on a dataset, I am guessing that you could use a query to perform the data transformation and place it on the new datatable. Not sure if it will perform better then the loop
If I were you, I would keep the data in the DataTable as it is. It is after all, meaningful data that would lose its meaning upon conversion. I would make any desired modifications only when displaying/rendering the data because that implicitly requires a conversion of the data into strings (with optional formatting).
Any DateTime variable can be rendered as a string (with culture-sensitive formatting) using the simple code:
DateTime.Now.ToShortDateString();
// Or
DateTime.Now.ToString("d");
This function already uses formatting information derived from the current culture.
I really would suggest that you take another look at your scenario to evaluate if you really need to change the datatype of data in the dataset itself. (or provide us with more information)