Concur / Cognos Report Studio: Filter with options for timeframe always using timepropmt values? - cognos

I am working with Concurs IBM Cognos integrated solution. The data i am working with is travel expense report data. My goal for this report is to have a prompt page that allows the user to select the timeframe from which the report should pull the data.
Since this report may also be scheduled to run on a regular basis, it should not only include a daterange prompt (or in this case two date prompts), but also options for relative timeframes like "Last year", "Last 6 months" and "Year to date".
So far i have set up a prompt page using two dateprompts ("TravelDateIntervallStart" and "TravelDateIntervallEnd") and two value prompts. Only one of these value prompts is relevant for the timeframe options though.
The idea is to have the dateprompts in place for the user to run ad hoc reports for a specific timeframe.
The value prompt ("RelativeTimePrompt") should then provide the options to use a relative timeframe depending on when the report is scheduled to run, in addition to the "SelectTimeFrame" option where the date prompts are used. I have set up the options accordingly within the value prompt and built a filter as follows:
CASE ?RelativeTimePrompt?
WHEN 'SelectTimeframe' THEN
([Arrival Date/Time] between ?TravelDateIntervallStart? and ?TravelDateIntervallEnd?
AND
[Departure Date/Time] between ?TravelDateIntervallStart? and ?TravelDateIntervallEnd?)
WHEN 'Last12m' THEN ([Arrival Date/Time] >= _add_years (current_date, -1) AND [Departure Date/Time] >= _add_years (current_date, -1))
WHEN 'Last6m' THEN ([Arrival Date/Time] >= _add_months (current_date, -6) AND [Departure Date/Time] >= _add_months (current_date, -6))
WHEN 'Year2Date' THEN (_year([Arrival Date/Time]) = _year (current_date) AND _year([Departure Date/Time]) = _year (current_date))
END
When "Year to date" ("Year2Date") is selected in the value prompt, then it throws an error:
"RQP-DEF-0177
An error occurred while performing operation 'sqlPrepareWithOptions' status='-126'.
CAF-WRN-2082 An error has occurred. Please contact your administrator. The complete error has been logged by CAF with SecureErrorID:"[some date and number]
Ofc i googled the error, but wasnt able to find anything applicable in my case. Is there anything obvious that might be causing an error with the "Year to date" filter?

In a new report, bring in the date fields and take the filter expression out of the case. So just _year([Arrival Date/Time]) = _year (current_date) AND _year([Departure Date/Time]) = _year (current_date) to see if that still fails.
If it does you could try changing it to:
extract(year,[Arrival Date/Time]) = extract(year, current_date) AND extract(year,[Departure Date/Time]) = extract(year,current_date)
or
extract(year,[Arrival Date/Time]) = #
timeStampMask($current_timestamp,'YYYY')
# AND extract(year,[Departure Date/Time]) = #
timeStampMask($current_timestamp,'YYYY')
#

Related

Trying to make a IF(AND) statement work in excel

I am trying to use an IF(AND statement in excel however it is not working properly. It seems one of the functions does work but the other one does not.
I have tried deleting the AND part of the formula and using only the IF however it still has the same problem.
The code I am using at the moment is:
=IF(AND(COUNTIFS(F10:F15, "=<" & 2000) = 0, COUNTIFS(F10:F15, ">=" & 2000) = 0), "All of the properties were constructed ", "The majority of properties were constructed ")
The main problem is that when all the data shows 2000 or above the formula still shows "the majority of the properties" when it should show "all of the properties". When the data is 1999 or less it does change to "All of the properties".
Basically if all values in F10:F15 are 2000 or above it should return "all of the properties were constructed" and if all the values are 1999 or below it should also return "all of the properties were constructed". Otherwise it should state "the majority of the properties were constructed".
So, based on your comment I think this will do what you expect:
IF(COUNTIFS(A2:A21, ">" & 2000)=COUNT(A2:A21), "All of the properties were constructed ", "The majority of properties were constructed ")
See this showing both results:

Excel TEXT(dd.mm.yyyy) function and different client languages

How can I make a function with a formatted date that will work in every language? I want to make the following function:
=CONCATENATE(TEXT(C8;"TT.MM.JJJJ");"/";G8)
The problem here is, that I use the english client but because I'm a german, excel forces me to use T for day and J for year. I think this will cause problem on a PC located in england (for example).
I think [$-409] won't work because I still have to use T for day and J for year. Is there a good solution for this (function wise)?
If you pass the value of a formula in "" then it cannot be changed based on the localisation settings.
A good way to do it is to use a custom function with VBA, returning "TT.MM.JJJJ" if you are in Germany and "DD.MM.YYYY" if you are in England.
Public Function CorrectString() As String
Select Case Application.International(XlApplicationInternational.xlCountryCode)
Case 1
CorrectString = "DD.MM.YYYY"
Case 49
CorrectString = "TT.MM.JJJJ"
Case Else
CorrectString = "ERROR"
End Select
End Function
Would allow you to call the function like this:
=CONCATENATE(TEXT(C8;CorrectString());"/";G8)
And depending on the excel language, it would give either the German or the English versions.
To simplify the formula, try calling only:
=TEXT(21322;CorrectString())
This should return 17.05.1958.
Source for the regional languages, mentioned by #Dan at the comments:
https://bettersolutions.com/vba/macros/region-language.htm
Or run this to see the corresponding number of your current Excel:
MsgBox xlApplicationInternational.xlCountryCode
Just dropping in another imho elegant (VBA free) alternative taken from: Stackoverflow answer by #Taosique
=IF(TEXT(1,"mmmm")="January",[some logic for English system],[some logic for non-English system])
I've had the same problem and solved it with similar VBA Function. My function accepts input in international format, and outputs the local version for user.
Please see code below:
Function DateFormater(sFI As String)
Dim aFI() As String
aFI = split(StrConv(sFI, vbUnicode), Chr$(0))
ReDim Preserve aFI(UBound(aFI) - 1)
For i = 0 To UBound(aFI)
Select Case (aFI(i))
Case "m", "M"
DateFormater = DateFormater & Application.International(xlMonthCode)
Case "y", "Y"
DateFormater = DateFormater & Application.International(xlYearCode)
Case "d", "D"
DateFormater = DateFormater & Application.International(xlDayCode)
Case Else
DateFormater = DateFormater & aFI(i)
End Select
Next i
End Function
A simpler solution is to use generic Excel functions.
=CONCATENATE(TEXT(DAY(C8;"00");".";TEXT(MONTH(C8);"00");".";YEAR(C8);"/";G8)

Running PeopleSoft Query with Excel VBA Hyperlink

I've used similar code below to run "public" PeopleSoft queries from Excel using VBA. When I look at the hyperlink produced from the code below, it is similar to the public queries we run with this method. The only difference is this is a "private" query. I can manually run the query in PeopleSoft with these same prompts and it runs and produces results like it is supposed to (32 rows). However, when I run this code from Excel, PeopleSoft opens, you sign in and it looks like the query runs. However, it doesn't return any results (0 rows). Is this there some twist with running "private" queries. Is it not possible to run "private" queries with this method? Any suggestions would be greatly appreciated as this has us stumped. Thanks for the help......
We are using Excel 2010, PeopleSoft 9.1 and PeopleTools 8.52 if that helps
Dim vFROMACCT As Date
Dim vTOACCT As Date
vFROMACCT = "07/01/2016"
vTOACCT = "07/21/2016"
vFROMACCT = Format(vFROMACCT, "MM/DD/YYYY")
vTOACCT = Format(vTOACCT, "MM/DD/YYYY")
vHypRoot = "http://pswebfsprd.myco.com/fsprd_1/EMPLOYEE/ERP/q/?ICAction=ICQryNameExcelURL=PRIVATE.CAR_SALES_1"
vHypLnk = vHypRoot
vHypLnk = vHypLnk & "&bind1=" & vFROMACCT
vHypLnk = vHypLnk & "&bind2=" & vTOACCT
With Worksheets("Sheet1")
.Hyperlinks.Add .Cells(10, 1), vHypLnk
.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End With
If you are getting 0 results then the query is running. I believe your problem is with your date parameters. I was able to run a private query with a date parameter but I had to use the date in YYYY-MM-DD format.
&BIND1=2016-07-21
This was on DB2 so it may be different for your DB. If you need to use a format with slashes in it, ensure you encode the URL before submitting it. Here is a Stack Overflow question on urlencoding in VBA
My full URL was:
https://dev.removed.com/psp/mydev/EMPLOYEE/ERP/q/?ICAction=ICQryNameURL=PRIVATE.TEST_DS&BIND1=2016-07-21
Note: This was on PeopleTools 8.54.13 but should work on 8.52

Filtering a Pivot Table Automatically in Excel

I'm building a DB for school activities in the afternoon. I'm trying to create a search option through a form that controls a pivot table in which the user can filter on the class type and/or the age group and or the school year.
I wrote this code in VBA and it's not working. When i tried to write a code to filter on only one of the above (such as class type) it worked but when I expanded it to 3 filter options it isn't working. It fails when no value is inserted in one of the options.
search_class.Hide
ActiveSheet.PivotTables("PivotSearchClass").PivotFields("class type").ClearAllFilters
If IsNull(Range("type_search").Value) Then
ActiveSheet.PivotTables("PivotSearchClass").PivotFields("class type").CurrentPage = "(All)"
Else: ActiveSheet.PivotTables("PivotSearchClass").PivotFields("class type").CurrentPage = Range("type_search").Value
End If
type_box = "pick a class type"
ActiveSheet.PivotTables("PivotSearchClass").PivotFields("group age").ClearAllFilters
If IsNull(Range("target_search").Value) Then
ActiveSheet.PivotTables("PivotSearchClass").PivotFields("group age").CurrentPage = "(All)"
Else: ActiveSheet.PivotTables("PivotSearchClass").PivotFields("group age").CurrentPage = Range("target_search").Value
End If
target_box = "pick a group age"
ActiveSheet.PivotTables("PivotSearchClass").PivotFields("school year").ClearAllFilters
If IsNull(Range("year_search").Value) Then
ActiveSheet.PivotTables("PivotSearchClass").PivotFields("school year").CurrentPage = "(All)"
Else:
ActiveSheet.PivotTables("PivotSearchClass").PivotFields("school year").CurrentPage = Range("year_search").Value
End If
year_search_box = "pick a school year"
ActiveSheet.PivotTables("PivotSearchClass").PivotCache.Refresh
Does anyone know ehat the problem is and how to fix it?
I think it will work if you change your tests to either:
If IsEmpty(Range("type_search").Value)
or
If Range("type_search").Value = ""
IsNull is used to test whether a variant variable contains a null value, which won't be true with either a blank or filled cell.
I don't have Excel on this computer and pivot tables are my weakness but I'll try to help since you seem alone on this. First make sure your script is indeed running the "True" case of your if statement and then I would edit the value of CurrentPage to see if your issue is there (i.e., change the "(all)" value to something else). Where does the error lie and what is the error description?

Report on individual password expiration intervals in Sybase ASE 12.5

I want to run a report to make sure the password of every user is set to expire every 30 days, but the expiration interval doesn't seem to be stored in syslogins?
you can get report with following proc:
use sybsystemprocs
go
----------------------------------------------------------------------------
print 'sp__helpexpire'
----------------------------------------------------------------------------
if exists (select 1 from sysobjects where type = "P" and name = "sp__helpexpire")
drop proc sp__helpexpire
go
create procedure sp__helpexpire
as
begin
set nocount on
declare #swexpire int
select #swexpire=value from master.dbo.sysconfigures
where name = 'systemwide password expiration'
print "Serverwide password expire: %1!" ,#swexpire
print ""
print "Logins:"
print "=============================================================="
select l.name login , case a.int_value
when null then #swexpire
else a.int_value end "expire in days"
from master.dbo.syslogins l , master.dbo.sysattributes a
where l.suid *= a.object
and a.object_type='PS'
and a.attribute=0
and object_cinfo='login'
print ""
print "Roles:"
print "=============================================================="
select r.name "role name", case a.int_value
when null then #swexpire
else a.int_value end "expire in days"
from master.dbo.syssrvroles r , master.dbo.sysattributes a
where r.srid *= a.object
and a.object_type='PS'
and a.attribute=0
and object_cinfo='role'
end
go
it is always a good idea to check source code of those system procedures (stored in sybsystemprocs database) which manipulate with records you are looking for (in this case it is sp_addlogin, sp_modifylogin)
You can use sp_configure to set all users password expiration date
sp_configure "systemwide password expiration", 30
go
will set all users passwords to expire after 30 days. Not sure if this value can be read for a report though. The default is 0.
try
exec sp_displaylogin
to get the perms for the settings for an individual user, logged in as that user.

Resources