I am facing a problem on Cognos 10 with the LIKE function.
I have a varchar field named EOM_DATE which contains the end of months values, for example: 2017_01, 2017_02, etc.
I want to build a query like this:
[RiskDM2].[ADAV_RISKDATAMART].[EOM_DATE] LIKE ('2016%', '2017%', '2018%')
because I want that only the specified years to show.
Any solution?
I have tried different solutions using LIKE, STARTS WITH and even IN, but none of them seems to work.
You have to break it out. The pattern you are using only works with IN and IN doesn't support wildcards.
Try this:
[RiskDM2].[ADAV_RISKDATAMART].[EOM_DATE] LIKE '2016%'
OR
[RiskDM2].[ADAV_RISKDATAMART].[EOM_DATE] LIKE '2017%'
OR
[RiskDM2].[ADAV_RISKDATAMART].[EOM_DATE] LIKE '2018%'
This is effectively a long-form of IN, but it allows you to use the LIKE operator.
Related
currently I am working with a Logic App, I want to set the hours to a given DateTimeFormat to 00:00:00 with a Variable. After that I try to add an int variable as hours with it, but that doesn't work. Any ideas?
formatDateTime(addHours(utcNow(), -utcNow().Hour + variables('Daytime')), concat('yyyy-MM-ddTHH:mm:ss', variables('DateTimeOffset')))
It would be nice to know what values the variables have in them because without it, it's not as easy to provide a complete answer, but, bottom line, you can't use + like you have in the expression.
If you want to add and minus, etc., you need to use the inbuilt function add.
The expression builder is a function based approach.
Without knowing exactly what you want to achieve, something like this will help you along ...
concat(addHours(formatDateTime(utcNow(), 'yyyy-MM-dd'), 6, 'yyyy-MM-dd HH:mm:ss'), '+06:00')
... but will need to be cleaned up.
You also need to replace my hardcoded values with your variables.
I am trying to build an IF formula but I am getting an error that I have too many arguments. Any idea how to fix this?
=IF(BZ190=$C$163,$C$163, IF(BZ190=$C$163*$C$165,$C$163*$C$166, IF(BZ190=$C$163*$C$166,$C$163*$C$167, IF(BZ190=$C$163*$C$167,Z190=$C$163*$C$168, IF(BZ190=$C$163*$C$168,$C$163*$C$169, IF(BZ190=$C$163*$C$169,$C$163*$C$170, IF(BZ190=$C$163*$C$170,$C$163*$C$171, IF(BZ190=$C$163*$C$171,$C$163*$C$172, IF(BZ190=$C$163*$C$172,$C$163*$C$173, IF(BZ190=$C$163*$C$173,$C$163*$C$174, IF(BZ190=$C$163*$C$174,$C$163*$C$175, IF(BZ190=$C$163*$C$175,$C$163), IF(AND((SUM(BZ190:BZ$190)-CA$168)<0,BZ190=""),$C$163*$C$165,"")))))))))))
The last but one if-clause looks like this:
IF(BZ190=$C$163*$C$175,$C$163),
^
|
| bracket is obsolete
There should not be a bracket at the end, it should just be:
IF(BZ190=$C$163*$C$175,$C$163,
But I have another point here: imagine that, within half a year or within a year, you need to modify something. How will you find out what all those things mean? Therefore I'd advise you to use names, something like:
$C$163 equals "interest_rate"
$C$165 equals "student_income"
...
Like this, your formula will become something like:
IF(BZ190=interest_rate,interest_rate,
IF(BZ190=interest_rate * student_income, ...
This will be much clearer to read and to maintain. And, oh, before I forget: writing the formula in multiline (one if-clause per line) also increases readability and maintainability.
I'm writing a script to scrape from another website with Python, and I am facing this question that I have yet to figure out a method to resolve it.
So say I have set to replace this particular string with something else.
word_replace_1 = 'dv'
namelist = soup.title.string.replace(word_replace_1,'11dv')
The script works fine, when the titles are dv234,dv123 etc.
The output will be 11dv234, 11dv123.
However if the titles are, dv234, mixed with dvab123, even though I did not set dvab to be replaced with anything, the script is going to replace it to 11dvab123. What should I do here?
Also, if the title is a combination of alphabits,numbers and Korean characters, say DAV123ㄱㄴㄷ,
how exactly should I make it to only spitting out DAV123, and adding - in between alphabits and numbers?
Python - making a function that would add "-" between letters
This gives me the idea to add - in between all characters, but is there a method to add - between character and number?
the only way atm I can think of is creating a table of replacing them, for example something like this
word_replace_3 = 'a1'
word_replace_4 = 'a2'
.......
and then print them out as
namelist3 = soup.title.string.replace(word_replace_3,'a-1').replace(word_replace_4,'a-2')
This is just slow and not efficient. What would be the best method to resolve this?
Thanks.
I'm new to python and I'm trying to keep part of the following:
'/this/is/my/path'
and I would like to keep this:
'/my/path'
My problem is that the path is dynamic and the length is not the same all the times. And practically I would like to 'delete' the first two parts.
If I use this:
os.getcwd().split("/")[2:5]
my problem is that is not dynamic and also it converts it into a list that I do not want.
Any ideas?
I want to have a matrix/cell, that has strings inside that I can access and use later as strings.
For instance, I have one variable (MyVar) and one cell (site) with names inside:
MyVar=-9999;
site={'New_York'; 'Lisbon'; 'Sydney'};
Then I want to do something like:
SitePosition=strcat(site{1},'_101'}
and then do this
save(sprintf('SitePosition%d',MyVar),);
This doesn't work at all! Is there a way to have strings in a matrix and access them in order to keep working with them if they were a string?
This:
MyVar=-9999; site={'New_York'; 'Lisbon'; 'Sydney'};
SitePosition = strcat(site{1},'_101');
save(sprintf('SitePosition%d',MyVar));
Works fine and yields SitePosition-9999.mat, note the syntax changes in lines 2 and 3.
Is there something else you're expecting?
EDIT: Based on your comment
Check out the documentation for save regarding saving specific variables
New example:
MyVar=-9999;
site={'New_York'; 'Lisbon'; 'Sydney'};
SitePosition = strcat(site{1},'_101');
save(SitePosition,'MyVar');
Creates New_York_101.mat with only the variable MyVar in it.