In Cognos 10.1 Report Studio, I am having an issue displaying a calculated date. In an attempt to calculate the previous date based on a date prompt and display it in a report header, I have tried the following:
_add_days(_make_timestamp(
string2int32 (substring(ParamValue('p_AsOfDate'),1,4))
,
string2int32 (substring(ParamValue('p_AsOfDate'),6,2))
,
string2int32 (substring(ParamValue('p_AsOfDate'),9,2))
),-1)
for 7/1/2016, it returns "00/30/2016"
Note that ParamValue('p_AsOfDate') returns 2016-07-01. I laboriously extracted and tested each piece
_make_timestamp(2016,06,30) returns "00/30/2016"
Is this a bug, or am I missing something obvious.
Related
I have a calculated field in a crosstab formatted as a percent with 1 decimal place
The calculation works fine
The results however show an asterisk (after the percent sign) even when exported to Excel
What I have found on some web searches is Cognos shows an asterisk when the unit of measure is unknown. Not sure if this applies to what I am doing with Cognos
The calculation is B divided by A
I solved the (annoying) issue (in a crosstab column) by:
Define content of the Crosstab intersection: yes
Unlock report
Drag and drop in the cell a Text Box
Change the textbox Source Type to Report Expression
Insert the calculation as a Report Expression instead of a query calculation
I found an answer, set the format to custom and enter the data pattern
For example,
##0.0%
We are looking to compare the calendar start date with the current date in flow. Currently we are pulling the start date through a filter query like this:
formatDateTime('EventDate','M-d-yyy hh:mm')
and comparing to this:
formatDateTime(addDays(utcNow(),3),'M-d-yyyy hh:mm')
I am getting this error currently: "Unable to process template language expressions in action 'Get_items' inputs at line '1' and column '17987': 'In function 'formatDateTime', the value provided for date time string 'EventDate' was not valid. The datetime string must match ISO 8601 format."
Any help on this would be greatly appreciated!
You could Initialize a variable like the following below and then do a IF condition.
#{add(div(sub(ticks(utcNow()),ticks('1900-01-01')),864000000000),2)}
I test with the same formula to convert event start date and it works fine in my end. The if condition returns correct result on different conditions.
Here is the logic of my demo flow, please have a check:
I use get item to get the start date of a certain event in the calendar list and convert the start time dynamic content to the format I need. Almost same with yours.
According to the error message, it seems the format of the event date column is not in the supported format. Would you like to provide the settings of your event date column? I test with the default start time column and a custom date & time column of default settings. Both of them works fine with the flow above.
Update:
The two formulas used are displayed below:
formatDateTime(outputs('Get_item')?['body/Event_x0020_Date'],'M-d-yyy hh:mm')
formatDateTime(addDays(utcNow(),3),'M-d-yyyy hh:mm')
I just directly use the outputs of the data compose action in the if condition
What worked for me was to build a sequence of numbers with the dates being ordered by day, month and year this way, when converting to integer, it's easy to compare
int(formatDateTime(utcNow()),'yyyyMMdd'))
if you need add day for exemple, you can use
int(formatDateTime(addDays(utcNow(),variables('extraDays')),'yyyyMMdd'))
and the other date like this
int(formatDateTime(variables('FinalDate'),'yyyyMMdd'))
Based on your example, you can put hours and minutes without any problems, just remove the special characters and spaces
but by the definition of the error you are having, I believe it is because of the way you are writing the variable
I'm trying to get the option price from 11/8/17 to 14/8/17 with the 12/20/19 expiration for the 4200 put on the SX5E Index.
I wrote the code below but it gives me an N/A Invalid Field error.
=BDH("SX5E 12/20/19 P4200 Index",11/8/2017,14/8/2017)
I tried changing the dates around and adding a 0 before the 8 but it does not work and the security name is valid as I searched it on bloomberg and fixed an error that said it was invalid from before.
You haven't specified a field. Say you want to retrieve the daily price, you can use PX_LAST for example:
=BDH("SX5E 12/20/19 P4200 Index", "PX_LAST", 20170811, 20170814)
Also note that I'm not sure it will work with the date format you are using, I've changed it to yyyymmdd. Alternatively you can use references to other cells containing the dates you need.
I was wondering if anybody else came across the same problem. It's been bugging me for weeks now.
I have a big table in my report pulling data from DataSet A, one column contains data from DataSet B and is pulled using the followin:
=Lookup(Fields!Date.Value, Fields!Date.Value, Fields!Sales.Value, "Sales")
Running report shows no errors, all numbers are displayed. However when I export the report to any format (tried CSV, EXCEL, PDF) the value from lookup column comes as #Error (CSV, PDF) or #VALUE! (EXCEL).
Looking for any help on the internet proved to be unsuccessful. Is there anybody who stumpled upon the same problem?
If you can lookup the data field from another dataset properly, it should not be the issue on lookup() function. I've also tested in my local environment, the data can be rendered after exporting. In this scenario, I suggest pay attention to the data type and data length. Can you show the sample data in your BIDS/SSDT?
Turns out it was the fact that I was returning more than one row from the other dataset (not always but in some cases yes). Normally I would create calculate field (different currencies and sales value) and sum them in the report. SSRS didn't have problem showing the first value by default but export functionality failed, since I did't SUM() rows that were find. I change the Dataset then to calculate the values after currency conversion and them wrapped it in another select statement to make sure I only have one for my Date.Value
I have calulated column which display's the value based on the difference between today and requested date field.
=Today-[Requested Date]
This is working fine in Sharepoint Standard View. But the same is not working with the datasheet view . The calculated column is showing as below
=#NAME?-[Requested Date].
Due to this i am not able to save the data. Can anyone please let me know how to solve this ?
Which SharePoint version are you using?
I tried the same scenario using SharePoint 2013 and was able to add the values in both standard and datasheet views. I am assuming you might have used the same steps.
Create 2 new columns named RequestedDate(DateTime) and
Today(Single line of text).
Add a new column of type calculated field with formula
=Today-[Requested Date].
Now delete the Today column.
Try entering the data in both the views.
First I have used today() function to calculate difference between 2 days except working days. The list is not automatically updating. If we change the Start_Date, then it calculates and gives the value. Can you suggest me why this happens?
You have mentioned in your post that there is some tricks in using today() function. I have created separate Today_Date column in my list. And Used the same column name in finding difference between 2 days. Here also the same problem exists.
The formula I used is,
=IF(AND((WEEKDAY([Today Date],2))<(WEEKDAY([Release Date],2)),((WEEKDAY([Release Date],2))-(WEEKDAY([Today Date],2)))>1),(((DATEDIF([Release Date],[Today Date],"D")+1))-(FLOOR((DATEDIF([Release Date],[Today Date],"D")+1)/7,1)*2)-2),(((DATEDIF([Release Date],[Today Date],"D")+1))-(FLOOR((DATEDIF([Release Date],[Today Date],"D")+1)/7,1)*2)))
Please tell me how to make the difference between 2 date values update automatically every time I open the list.
Then I tried the trick which you have mentioned above. But it works while I enter the data. When I open the list for the next day or some other day's after the Calculated column is not taking the current day's value, do the data remains same. what should I need to do in case it needs to take current date's value and calculate the formula?