Pervasive PSQL Control Centre / Currency data type - pervasive

Having issues updating a Pervasive PSQL table using Pervasive Control Centre and wonder if anyone can point me in the right direction. I'm struggling to update a field in the table whose type is '254-VB Currency'.
Sample query:
Update TABLE set "remBal" = 100.00 where 'Posting' = 215288;
The value that ends up in the remBal field is 463673729135463.6288
Pervasive version is v10.30. Updating via e.g. VAccess control works fine. It's just Pervasive Control Centre that doesn't.

The VAccess control supports more data types than the standard PSQL engine does. The VB Currency data type is not one that's natively supported in PSQL.
According to MSDN, the Currency data type is defined as:
Currency variables are stored as 64-bit (8-byte) numbers in an integer
format, scaled by 10,000 to give a fixed-point number with 15 digits
to the left of the decimal point and 4 digits to the right. This
representation provides a range of -922,337,203,685,477.5808 to
922,337,203,685,477.5807.
What I would suggest, is enter 100.00 to the database using VAccess, then look at the value in Control Center. You can then use that value in your SQL statement. It's not pretty but it might work.

Related

How can I add Multiple Time dimensions on the same Google Data Studio chart?

I would like to check if it's possible to plot more than one time-dimensions in a Google Data Studio chart, preferably a time series (line) chart. I'm having a lot of trouble to represent different information in the same chart through Google Data Studio.
I want to represent a sales cycle, that has 8 stages, meaning that most of them does not occur in the same day. All of them are related to one client/user. I've treated the data so I have this information separated, as I'm able to use it and create different and separated graphs - my intention, although, is to create one common graph with the time dimension not necessarily related to the other DateTime metrics.
Data set (Google Sheets):
Client ID (string)
Sign in at (date)
Commercial Approval at (date)
Commercial Approved (string)
Contract signed at (date)
Contract signed (string)
A
03/12/2021
05/12/2021
A
06/12/2021
A
B
03/12/2021
C
04/12/2021
05/12/2021
C
07/12/2021
C
D
05/12/2021
06/12/2021
D
E
06/12/2021
06/12/2021
E
The result I want to achieve (hand-made, on the PowerPoint):
Google Data Studio result I'm achieving:
Google Data Studio makes me choose one of the Date dimensions as the dimension. For example, if I chose the Signed at as a dimension and choose the period as between (including) 04/12/2021 and 06/12/2021, then Google Data Studio will group the Clients by Signed at, and overlook the activities by those that Signed at 03/12/2021.
You should try linking the two sources directly through the date's, and not choose any other dimension, only as metrics! This worked for me, but unfortunately I can't replicate it for another project.
It is worth a try anyway.
Looks like this:
enter image description here

How do RRD values in a database dump translate to the input values?

I am having trouble understanding the values that I have saved in my Round Robin Database. I do a dump with rrdtool dump mydatabase and I get a dump of the data. I found the most recent update, and matched it to my rrd update command:
$rrdupdate --template=var1:var2:var3:var4:var5 N:15834740:839964:247212:156320:13493356
In my dump at the matching timestamp, I find these values:
<!-- 2016-12-01 10:30:00 CST / 1480609800 --> <row><v>9.0950245287e+04</v><v>4.8264158237e+03</v><v>1.4182428703e+03</v><v>8.9785764359e+02</v><v>7.7501969607e+04</v></row>
The first value is supposed to be var1. Out of scientific notation, that's 90,950.245287, which does not match up at all to my input value. (None of them are decimal.)
Is there something special I have to do to be able to convert values from my dump to get the standard value that I entered?
I can't give you specifics for your case, as you have not shown the full definition of your RRD file (internals, DS definition, etc), however...
Values stored in an RRDTool database are subject to Data Normalisation, and are then converted to Rates (unless the DS is of type Gauge in which case they are assumed to be rates already).
Normalisation is when the values are adjusted on a linear basis to make them fit exactly into the time sequence as defined by the Interval (which is often 300 seconds).
If you want to see the values stored exactly as you write them, you need to set the DS type to 'gauge', and make Normalisation a null step. The only way to do the latter is to store the values exactly on a time boundary. So, if the Interval is 300s, then store at 12:00:00, 12:05:00, and so on - otherwise the values will be adjusted.
There is a lot more information about Normalisation - what it is, and why it is done - in Alex van den Bogaerdt's tutorial

Truncate (using ROUND) has stopped working after changing column data type

I use the following query on the SQL Server 2008 database of a 3rd party product to generate some reports.
SELECT ROUND(SUM(Price),0,1) AS SumNetPrice FROM Transactions
Eg
SUM(Price): 1.2345678
ROUND(SUM(Price),0,1): 1
This has worked fine until now and removed all of the decimal places. In fact curiously the result was truncated even if I didn't specify the 3rd parameter as per the MSDN information http://msdn.microsoft.com/en-us/library/ms175003.aspx on the ROUND function.
The 3rd party company has now changed the data type of the Price column from 'real' to decimal(22, 7). Unfortunately this now means that I always get 7 decimal places even when I use the truncate option of the ROUND function. So now I get:
ROUND(SUM(Price),0,1): 1.0000000
Shouldn't the ROUND(expression,0,1) truncate the result so I don't get any decimal places? How can I remove these decimal places from the result in the SQL query?
In order to make it working the way it worked earlier is to Convert the type from decimal to real. Here is your updated query to get desired output.
select Cast(ROUND(SUM(Price),0,1) as Real) AS SumNetPrice FROM Transactions
SELECT CAST(ROUND(SUM(Price),0,1) AS DECIMAL(22,0)) AS SumNetPrice FROM Transactions

SQL DataType - How to store a year?

I need to insert a year(eg:1988 ,1990 etc) in a database. When I used Date or Datetime
data type, it is showing errors. Which datatype should I use.
regular 4 byte INT is way too big, is a waste of space!
You don't say what database you're using, so I can't recommend a specific datatype. Everyone is saying "use integer", but most databases store integers as 4 bytes, which is way more than you need. You should use a two byte integer (smallint on SQL Server), which will conserve space.
If you need to store a year in the database, you would either want to use an Integer datatype (if you are dead set on only storing the year) or a DateTime datatype (which would involve storing a date that basically is 1/1/1990 00:00:00 in format).
Hey,you can Use year() datatype in MySQL
It is available in two-digit or four-digit format.
Note: Values allowed in four-digit format: 1901 to 2155. Values allowed in two-digit format: 70 to 69, representing years from 1970 to 2069
Storing a "Year" in MSSQL would ideally depend on what you are doing with it and what the meaning of that "year" would be to your application and database. That being said there are a few things to state here. There is no "DataType" for Year as of 2012 in MSSQL. I would lean toward using SMALLINT as it is only 2 bytes (saving you 2 of the 4 bytes that INT demands). Your limitation is that you can not have a year older than 32767 (as of SQL Server 2008R2). I really do not think SQL will be the database of choice ten thousand years from now let alone 32767. You may consider INT as the Year() function in MSSQL does convert the data type "DATE" to an INT. Like I said, it depends on where you are getting the data and where it is going, but SMALLINT should be just fine. INT would be overkill ... unless you have other reasons like the one I mentioned above or if the code requirements need it in INT form (e.g. integrating with existing application). Most likely SMALLINT should be just fine.
Just a year, nothing else ?
Why not use a simple integer ?
Use integer if all you need to store is the year. You can also use datetime if you think there will be date based calculations while querying this column
Storage may be only part of the issue. How will this value be used in a query?
Is it going to be compared with another date-time data types, or will all the associated rows also have numeric values?
How would you deal with a change to the requirements? How easily could you react to a request to replace the year with a smaller time slice? i.e. Now they want it broken down by quarters?
A numeric type can be easily used in a date time query by having a look-up table to join with containing things like the start and stop dates (1/1/X to 12/31/x), etc..
I don't think using an integer or any subtype of integer is a good choice. Sooner or later you will have to do other date like operations on it. Also in 2019 let's not worry too much about space. See what those saved 2 bytes costed us in 2000.
I suggest use a date of year + 0101 converted to a true date. Similarly if you need to store a month of a year store year + month + 01 as a true date.
If you have done that you will be able to properly do "date stuff" on it later on

Reporting Services Chart - Hard Coded Series

I am developing an SSRS 2008 report which contains a number of simple charts. On the x axis I have the 12 months of this year - Jan 2009 thru December 2009. On the Y is an integer value ranging from 0 to 100 in increments of 10. I am plotting the number of times an issue occurred per month. So January could have a value of 10, February 30, etc. etc.
I would like to have a horizontal line/series that is constant and shows the yearly average for 2008. So, say the average was 30 issues per month in 2008, I would like for that line to be shown in my chart. Basically, I want to draw a straight line across the chart for that value... I can see how to add more complex series, but this seemingly simple task is getting the better of me.
Doe anyone have any idea how this could be accomplished?
Thanks in advance,
Jason
[Update] To add some further details, I am already pulling the average for each row in my dataset and have it set up as its own series. However, rather than plotting a line, this approach plots individual points for each month. While this is close to what I want, I need to join the dots so to speak. The chart is of the Error Bar (Range) variety.
Can you use a column / line hybrid chart? If so then add a constant or dynamic target value to the chart:
Design the chart.
On the Data tab in the Chart Properties dialog box, add a new data value (for example, Target).
Set the target value (see the example in Figure 9 on link this uses a constant target value of 100000 across all categories but you can do it dynamically too). Make sure to use an expression starting with = (equals). Otherwise, the value is not interpreted as a numeric value.
See the example on the MS charts page at http://msdn.microsoft.com/en-us/library/aa964128.aspx
Add the yearly average to each row in the underlying the query. Add data series on just that value.
I managed to solve this issue myself.
As I mentioned, I was using an Error Bar graph. Right-clicking on the series of interest, I was able to change the graph type for that particular series - essentially leaving me with a chart with multiple graphs in it...particularly simple if you know where to look - which i did not! Thanks everyone for your suggestions.

Resources