Calculated Column with Null date end result needs to be text.
Good Morning,
I am using SharePoint 2010 and am trying to create a calculated column converting a date/time column to to show just a month and day. Calculation is
=TEXT([Anniversary],"m/d")
This is to enable sorting on the month. And this works fine except when there is no date entered in the "Anniversary" column.
I have tried to modify the formula in this column to no avail. http://social.technet.microsoft.com/Forums/sharepoint/en-US/0c9d5ae1-132a-4e02-8a91-c54708919d9a/show-calculated-date-column-as-null-when-there-is-no-date?forum=sharepointgenerallegacy
I do not have access to modifying the code so have to work strictly OOB. Any help would be greatly appreciated.
I would think you could add an IF statement to verify if the text is null. So...
=IF(ISNULL(TEXT(Anniversary, "m/d")), What we do when null, TEXT(Anniversary,"m/d"))
Andy Wessendorf SharePoint Developer II | Rackspace [email protected]
Similar Messages
-
To overcome column with null value-urgent
hai all,
when i query i get column with null value.
how to solve it?
thank in advance.
rcs
SQL> DESC SCOTT.CB1;
Name Null? Type
ID NUMBER
SUPCODE NUMBER
SUPLNAME VARCHAR2(100)
NAME VARCHAR2(100)
ITEMCODE VARCHAR2(10)
RECDOC NUMBER
RECDATE VARCHAR2(10)
TOTVALUE NUMBER
QTY NUMBER
CB_IPNO NUMBER
CB_VNNO NUMBER
CB_VDT VARCHAR2(10)
CB_AMT NUMBER
RECDOC_GR VARCHAR2(30)
RECDATE_GR DATE
SUPCODE_GR VARCHAR2(10)
TABLE LOOK LIKE THIS (NOT ALL DATA IN SAME ROW, BECUSE I INSERTED LAST 3 COLUMN VALUES):
ID SUPCODE SUPLNAME NAME ITEMCODE RECDOC RECDATE TOTVALUE QTY CB_IPNO CB_VNNO CB_VDT CB_AMT RECDOC_GR RECDATE_GR SUPCODE_GR
2015 AAAA 04117 9083 10545.6 78
2016 BBBB 04609 9087 25200 3600
2017 GGGG 04609 9088 28175 4025
2018 36591371.64 2565017.27
00001/07-08 02/04/2007 14020362
00002/07-08 02/04/2007 14020362
00003/07-08 02/04/2007 14010254
00004/07-08 02/04/2007 14010254
00005/07-08 02/04/2007 14021458
SQL> SELECT DISTINCT ID, SUPCODE_GR, NAME, ITEMCODE, RECDOC, RECDATE_GR, TOTVALUE, QTY FROM SCOTT.CB
1;
ID SUPCODE_GR
NAME
ITEMCODE RECDOC RECDATE_G TOTVALUE QTY
1
PRO.AT.ALU.POWDER UNCOATED
04609 15 51975 7425
2
PEN, GEL PEN
07969 17 154 11
ID SUPCODE_GR
I NEED RESULT AS FOLLOWS (ALL RESPECTIVE DDATA IN ONE LINE NOW NOT LIKE THAT):
ID SUPCODE SUPLNAME NAME ITEMCODE RECDOC RECDATE TOTVALUE QTY CB_IPNO CB_VNNO CB_VDT CB_AMT RECDOC_GR RECDATE_GR SUPCODE_GR
2015 AAAA 04117 9083 10545.6 78 00001/07-08 02/04/2007 14020362
============Even accounting for the formatting, I'm not sure I even understand the question. It could be any number of different problems or non-problems.
-
How to insert data in a column with uniqueidefier data type
Guys,
I need insert data in a column with uniqueidefier data type, when i am trying to that getting error.
error message says: "Conversion failed when converting from a character string to uniqueidentifier."
I have data in table a col1,col2,col3,col4 - col3,col4 has datatype as varchar and i am updating table b columns col1,col2 with table a col3 and col4.
Please guide how to do it.Hi,
Not any String can be convert to uniqueidentifier.
1. you have to make sure u use a value which is fir to be uniqueidentifier
2. Use convert or cast in the insert query in order to convert the string into uniqueidentifier
insert X ... convert(uniqueidentifier, 'string which fit to be convert to uniqueidentifier')
Please post DDL+DML for more specific help
DDL = Data Definition Language. In our case that is, CREATE TABLE statements for your tables and other definitions that are needed to understand your tables structure and there for let us to test and reproduce the problem in our server. Without DDL no one
can execute any query.
How to get DDL: Right click on the table in Object Explorer and select script table as CREATE. Post these create table scripts here.
DML = data manipulation language is a family of queries used for manipulating the data it self like: inserting, deleting and updating data. In our case we need some sample data in order to check the query and get result, so we need some indert query for
sample data.
If you post a "create query" for the tables and "insert query" with some sample, then we could help you without Assuming/Guessing. There is a reason that DDL is generally asked for and expected when discussing query problems - it helps
to identify issues, clarify terminology and prevent incorrect assumptions. Sample data also provides a common point of reference for the discussion. A script that can be used to illustrate or reproduce the issue you have, will encourage others to help.
[Personal Site] [Blog] [Facebook] -
Not able to save date column with custom date format. in OBIEE 11g
Hi,
I have migrated one report from OBIEE 10g to 11g. There is a date column with customized date format(i.e. Default format is 'dd-MMM-yyyy' and I have used 'MMM-yyyy').
But when I use this custom format and try to save the report in 11g its giving this below error.
''Catalog object privilege validation failed for user to path /shared/ALM BI/Finacial Results/History Income Statement Detail.
You do not currently have sufficient privileges to save a report or dashboard page that contains HTML markup.
This HTML might be present in column headings, table headings, text views, narrative views, the print header,
or the print footer and must be removed before saving.''
Please let me know what changes I need to do for this.
Regards,
Ambika Nanda.Hi ,
privilage issues...check the security settings once..
Thanks,
Ananth -
Sql query slowness due to rank and columns with null values:
Sql query slowness due to rank and columns with null values:
I have the following table in database with around 10 millions records:
Declaration:
create table PropertyOwners (
[Key] int not null primary key,
PropertyKey int not null,
BoughtDate DateTime,
OwnerKey int null,
GroupKey int null
go
[Key] is primary key and combination of PropertyKey, BoughtDate, OwnerKey and GroupKey is unique.
With the following index:
CREATE NONCLUSTERED INDEX [IX_PropertyOwners] ON [dbo].[PropertyOwners]
[PropertyKey] ASC,
[BoughtDate] DESC,
[OwnerKey] DESC,
[GroupKey] DESC
go
Description of the case:
For single BoughtDate one property can belong to multiple owners or single group, for single record there can either be OwnerKey or GroupKey but not both so one of them will be null for each record. I am trying to retrieve the data from the table using
following query for the OwnerKey. If there are same property rows for owners and group at the same time than the rows having OwnerKey with be preferred, that is why I am using "OwnerKey desc" in Rank function.
declare @ownerKey int = 40000
select PropertyKey, BoughtDate, OwnerKey, GroupKey
from (
select PropertyKey, BoughtDate, OwnerKey, GroupKey,
RANK() over (partition by PropertyKey order by BoughtDate desc, OwnerKey desc, GroupKey desc) as [Rank]
from PropertyOwners
) as result
where result.[Rank]=1 and result.[OwnerKey]=@ownerKey
It is taking 2-3 seconds to get the records which is too slow, similar time it is taking as I try to get the records using the GroupKey. But when I tried to get the records for the PropertyKey with the same query, it is executing in 10 milliseconds.
May be the slowness is due to as OwnerKey/GroupKey in the table can be null and sql server in unable to index it. I have also tried to use the Indexed view to pre ranked them but I can't use it in my query as Rank function is not supported in indexed
view.
Please note this table is updated once a day and using Sql Server 2008 R2. Any help will be greatly appreciated.create table #result (PropertyKey int not null, BoughtDate datetime, OwnerKey int null, GroupKey int null, [Rank] int not null)Create index idx ON #result(OwnerKey ,rnk)
insert into #result(PropertyKey, BoughtDate, OwnerKey, GroupKey, [Rank])
select PropertyKey, BoughtDate, OwnerKey, GroupKey,
RANK() over (partition by PropertyKey order by BoughtDate desc, OwnerKey desc, GroupKey desc) as [Rank]
from PropertyOwners
go
declare @ownerKey int = 1
select PropertyKey, BoughtDate, OwnerKey, GroupKey
from #result as result
where result.[Rank]=1
and result.[OwnerKey]=@ownerKey
go
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Hi All.
I have a control file which i need to add a column with header data value.
example
data file:
123456;201303
santiago;producto1;100
santiago;producto2;200
valparais;producto1;400
valparais;producto3;900
The control file skip the first column and load the three columns on the table, but, now i need to add other column with 201303 value constant of the first record and load it on the table.
Then
select * from table:
santiago producto1 100 201303
santiago producto2 200 201303
valparais producto1 400 201303
valparais producto3 900 201303
How i do this in the control file?
Regards!SCOTT@orcl_11gR2> host type test.dat
123456;201303
santiago;producto1;100
santiago;producto2;200
valparais;producto1;400
valparais;producto3;900
SCOTT@orcl_11gR2> host type test1.ctl
options (load=1)
load data
infile test.dat
replace
into table onecol_onerow
fields terminated by ';'
trailing nullcols
(filler1 filler, newcol)
SCOTT@orcl_11gR2> host type test2.ctl
options (skip=1)
load data
infile test.dat
append
into table test_tab
fields terminated by ';'
trailing nullcols
(col1, col2, col3,
newcol expression "(select newcol from onecol_onerow)")
SCOTT@orcl_11gR2> create table onecol_onerow
2 (newcol number)
3 /
Table created.
SCOTT@orcl_11gR2> create table test_tab
2 (col1 varchar2(15),
3 col2 varchar2(15),
4 col3 number,
5 newcol number)
6 /
Table created.
SCOTT@orcl_11gR2> host sqlldr scott/tiger control=test1.ctl log=test1.log
SQL*Loader: Release 11.2.0.1.0 - Production on Mon May 6 10:46:44 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 1
SCOTT@orcl_11gR2> select * from onecol_onerow
2 /
NEWCOL
201303
1 row selected.
SCOTT@orcl_11gR2> host sqlldr scott/tiger control=test2.ctl log=test2.log
SQL*Loader: Release 11.2.0.1.0 - Production on Mon May 6 10:46:45 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 4
SCOTT@orcl_11gR2> select * from test_tab
2 /
COL1 COL2 COL3 NEWCOL
santiago producto1 100 201303
santiago producto2 200 201303
valparais producto1 400 201303
valparais producto3 900 201303
4 rows selected. -
I am having trouble getting a numbers spreadsheet to hold different formats in the same column. A column with a date formatted heading will not convert to $ for the cells below. Any suggestions would help.
Hi Wayne,
Thank you for this response. I have tried this but when I start enterring $ amounts some, such as $6.00, go in OK others such as $4.00 appear as a date ie 4 Oct 12.
Kind regards
Paul -
Reports generated with null data
Hi,
I setup a role which has read access to all records under different tab corretly. However, the reports are displayed with null data. Any idea?
Thanks VKHi Bobb,
"Role-Based Can Read All Records" equal to No in my configuration. Requirement is not to allow report creation on others data.
So, if I make it Yes, then they can access all data in CRMOD and create report. Please let me know if my understanding is correct.
Thanks VK -
Show all Columns with datatype = date
Is it possible to select all columns with datatype = date in the Repository.
We like to cast it like dd.mm.yyyy.
Regards,
StefanWouldn't it be easier to do it in the presentation services rather than the .rpd?
Update: anyways, if you wanna be nasty, use something like this:
CONCAT( CAST ( DAYOFMONTH("Siebel Data Warehouse"."Catalog"."dbo"."Dim_Incident (W_INCIDENT_D)"."CLOSED_DATE") AS VARCHAR ( 2 )), CONCAT('.', CONCAT( CAST ( EXTRACT( MONTH FROM "Siebel Data Warehouse"."Catalog"."dbo"."Dim_Incident (W_INCIDENT_D)"."CLOSED_DATE") AS VARCHAR ( 2 )), CONCAT('.', CAST ( EXTRACT( YEAR FROM "Siebel Data Warehouse"."Catalog"."dbo"."Dim_Incident (W_INCIDENT_D)"."CLOSED_DATE") AS VARCHAR ( 4 ))))))
Message was edited by:
ChrisBerg -
PlotSeries with with null data
how I can PlotSeries with null data make unvisible (default it visible on horizontal axis)
It didn't help
-
How to take the Average of a DATEDIFF column with NULL values?
I am building an SSRS report that can display the average of a calculated datediff column in dd/hh/mm format with the following formula:
=Avg(IIF(Fields!LastCorrectedDate.Value is nothing,0, DATEDIFF("n",cdate(Fields!LastCorrectedDate.Value),cdate(Fields!
LastSignDate.Value)) \(60*24) & ":" & DATEDIFF("n",cdate(Fields!LastCorrectedDate.Value),cdate(Fields!
LastSignDate.Value)) mod (60*24)\60 & ":" & DATEDIFF("n",cdate(Fields!LastCorrectedDate.Value),cdate(Fields!
LastSignDate.Value)) mod (60*24) - (((DATEDIFF("n",cdate(Fields!LastCorrectedDate.Value),cdate(Fields!
LastSignDate.Value)) mod (60*24))\60)*60) ))
SSRS does not raise any errors with the formula and I have used the same formula for other columns without issue. I have noticed that this column includes null values which I think may be the problem. When the reports runs, it returns #ERROR on the column
but does not give a reason why. I am using SSRS report builder with visual basic logic as opposed to embedding SQL. Any help or feedback would be greatly appreciated.Hi No Ragrets,
According to your description, you want to calculate the average for the date time difference. Right?
In Reporting Services, Avg() function is only available for numeric values. In this scenario, the DateDiff() function to calculate the minutes difference will return a number. So we can do average calculation based on the return values first. Then we format
it as a time. We have tested this case in our local environment. Please try the following expression:
=floor(avg(DateDiff("n",Fields!StartDate.Value,Fields!EndDate.Value))) \(24*60) &":"&
floor(avg(DateDiff("n",Fields!StartDate.Value,Fields!EndDate.Value))/60 mod 24 )&":"&
floor(avg(DateDiff("n",Fields!StartDate.Value,Fields!EndDate.Value))) mod 60
The result looks like below:
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
Calculated Column with simple math for price comparisons
Hi all,
I want to calculate a price difference from today's price versus the price of 5 days ago.
Please help me with a best practice for that. Is the use of calculated column in a calculation view the right approach? How can the price field of 5 days ago be addressed? Ideally 5 should be a constant which should be able to be changed to 6 or 7 for further simulations.
Thanks for any help.
GuentherHi Patter ,
For the above requirement we don't need a calculation view to be created. Check the code below, I am re creating the scenario with an INNER JOIN.
CREATE COLUMN TABLE "METALS_ONE_GEN"."TEST_TAB" (ID INTEGER,DATES DATE,PRICE INTEGER);
INSERT INTO "METALS_ONE_GEN"."TEST_TAB" VALUES ( 1 , '2014-03-10',50);
INSERT INTO "METALS_ONE_GEN"."TEST_TAB" VALUES ( 1 , '2014-03-15',50);
INSERT INTO "METALS_ONE_GEN"."TEST_TAB" VALUES ( 1 , '2014-03-25',100);
INSERT INTO "METALS_ONE_GEN"."TEST_TAB" VALUES ( 1 , '2014-03-20',80);
INSERT INTO "METALS_ONE_GEN"."TEST_TAB" VALUES ( 1 , '2014-03-30',75);
INSERT INTO "METALS_ONE_GEN"."TEST_TAB" VALUES ( 1 , '2014-04-04',150);
INSERT INTO "METALS_ONE_GEN"."TEST_TAB" VALUES ( 1 , '2014-04-9',450);
select A.DATES,
A.PRICE,
( B.PRICE - A.PRICE )
from "METALS_ONE_GEN"."TEST_TAB" A
INNER JOIN "METALS_ONE_GEN"."TEST_TAB" B
ON
B.DATES = ADD_DAYS(A."DATES",5) ;
Looks like, the JOIN operation is more optimized than the Calculation view in this case . Depends on the data , JOIN type may very .
Sreehari
Message was edited by: Sreehari V Pillai -
How to add custom columns with BO data from GP to UWL
Hi
We have CE 7.1 in our project UWL taskitems only have GP workflow tasks.
In UWL we can see that by default there are standard columns but now we need to add custom columns with data from ours BO associated to process instance
For that we need to develop one custom connector for UWL where we can retrieve the values from custom conenctor to UWL.
Currently our NWDS 7.1 does not have plugins for UWL Connector can anybody tell me where can I download this plugins?
thanks in advance!
Regards
CristianHi,
plz refer the following link
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0ee5047-c7a0-2a10-70b7-9557e3e4d440
Regards
Manohar -
Cross Tab Report...Calculated Column shows NULL
Hi there
I have one calculated field which is based on some calculation when I run my report in Discoverer Desktop I can see the 0 in NULL values in all rows.
But when I run this report in Discoverer Plus/Discoverer Viewer it shows me Null for some values or some values I can see the zeros.
I have checked the WorkBooks options its all set to 0.0.
1)
Edit---> WorkSheet Properties ---CrossTab Format ---Show Null values as 0.0
2)
Tools---> Options---> Sheet--->Show Null values as 0.0
3)
I have settings in Pref.txt which means Some reports I want to see the NULL values...
Pref.txt
NullValue = "NULL"
Do you have any idea..
Thanks
ASIMWell, I don't really have an idea what is happening, but i have a solution to hide nulls.
You can create an exception on the columns.
when column_name = Null then change the forecolor to match with the backcolor.
This will make the text and box of same color and will hide nulls.
Cheers :) -
Hi,
Kylie discovered here that you couldn't have null dates in the project gantt query
APEX 4.0.2 Project Gantt Chart - Error Code: 2002 Message: Empty input
As Valentina suggested, I found the actual dates are mandatory, while the chart tolerates missing planned dates - which is a complete reversal of what actual project data would have.
baseline project gantt with parent-child relationship
What I found though is if some planned dates are missing, the generated XML seems to default with data from previous rows.
As detailed in this screenshot, my red lines indicate missing from/to dates (actual data also shown underneath chart)
https://docs.google.com/file/d/0B_eVXQ_oe4tsRUFXUzA0NmNMUE0/edit?usp=sharing
NAME TASK_ID ACTUAL_START ACTUAL_END PROGRESS DUE_START DUE_END
line 1 1810794 07/MAR/2013 11/MAR/2013 100 26/MAR/2013 27/MAR/2013 00:00:00
line 2 1810780 12/MAR/2013 16/MAR/2013 100 23/MAR/2013 27/MAR/2013 00:00:00
line 3 1810779 17/MAR/2013 20/MAR/2013
line 4 1810773 21/MAR/2013 21/MAR/2013 50 24/MAR/2013
line 5 1810774 22/MAR/2013 10/APR/2013 93 16/MAR/2013
line 6 1810791 11/APR/2013 20/APR/2013
line 7 1810793 21/APR/2013 22/APR/2013 45 21/MAR/2013 The accompanying XML backs up the story, yet my query doesn't feed this data.
<task id="1810794" parent="" name="line 1" actual_start="2013.03.07 00.00.00" actual_end="2013.03.11 00.00.00" baseline_start="2013.03.26 00.00.00" baseline_end="2013.03.27 00.00.00" progress="100" style="defaultStyle"/>
<task id="1810780" parent="" name="line 2" actual_start="2013.03.12 00.00.00" actual_end="2013.03.16 00.00.00" baseline_start="2013.03.23 00.00.00" baseline_end="2013.03.27 00.00.00" progress="100" style="defaultStyle"/>
<task id="1810779" parent="" name="line 3" actual_start="2013.03.17 00.00.00" actual_end="2013.03.20 00.00.00" baseline_start="2013.03.23 00.00.00" baseline_end="2013.03.27 00.00.00" style="defaultStyle"/>
<task id="1810773" parent="" name="line 4" actual_start="2013.03.21 00.00.00" actual_end="2013.03.21 00.00.00" baseline_start="2013.03.24 00.00.00" baseline_end="2013.03.27 00.00.00" progress="50" style="defaultStyle"/>
<task id="1810774" parent="" name="line 5" actual_start="2013.03.22 00.00.00" actual_end="2013.04.10 00.00.00" baseline_start="2013.03.16 00.00.00" baseline_end="2013.03.27 00.00.00" progress="93" style="defaultStyle"/>
<task id="1810791" parent="" name="line 6" actual_start="2013.04.11 00.00.00" actual_end="2013.04.20 00.00.00" baseline_start="2013.03.16 00.00.00" baseline_end="2013.03.27 00.00.00" style="defaultStyle"/>
<task id="1810793" parent="" name="line 7" actual_start="2013.04.21 00.00.00" actual_end="2013.04.22 00.00.00" baseline_start="2013.03.21 00.00.00" baseline_end="2013.03.27 00.00.00" progress="45" style="defaultStyle"/>Is this expected behaviour?
Is this a bug?
Is there a workaround - can I supply my own XML to hopefully override what is being generated?
ScottHi Ahmed
Thank you for your reply.
The time scales in Gantt chart specifically shows the year, month and weeks from the start date of project definition or basic start of WBS.
Since it is not a decided project, the Gantt chart need to show 0, 1st week, 2nd week, 3rd week etc.
The actual schedule from PD start date can be produced on actual initiation of project.
It means, i am looking for having Gantt chart for duration and not for specific start and finish dates.
warm regards
ramSiva
Maybe you are looking for
-
How can I fix the error image and get the regular image to load?
Ever since the recent big update for Firefox I've been getting some sort of error for loading certain images. Here: http://tinypic.com/r/103bf3l/8 I have put one of those sites that give that error --The original image that is supposed to show is als
-
2nd hard drive in Satellite Pro P200
Hi everyone I have a Satellite Pro P200. Does anyone know where I can get a lead and a caddy to install a 2nd hard drive?
-
Sourcing Rules and Approved Supplier List in 11.5.10
Does anybody know: Is it possible to default supplier information (and additionally source document information) into requisition and purchase order using sourcing rules and ASL for services, using only category and not item numbers? Thanks, Leonie
-
Cannot upload attachments in Gmail using Firefox 5.o
Gmail locks up when I try and upload an attachment. I have to kill it with the Task Manager. This happened after I upgraded to Firefox 5.0 --there was some blurb about a Gmail problem, but I don't recall it as impacting attachments or I wouldn't have
-
How to delete music in iOS 7?
Yesterday, I upgraded to the new iOS 7! Yay! It's really cool, and I do like it, though I'm having problems with my music app.. There's a few albums I don't want on my phone, and it won't allow me to delete them. I try sliding to the right, and nothi