how to get multiple values using LIKE function - cognos-10

We have the data abc,xyz,ijk,zya. I cannot use Like In function in Report Studio for multiple values. I am writing Street Name like ('abc'),Street Name like ('xyz'),Street Name like ('ijk'),Street Name like ('zya'). Is there any way i can implement Street Name in ('abc','xyz','ijk','zya'). Any other function we have in Cognos to implement like above. Like In is not working.

The only way I know how to get around this is to explicitly list out each individual search separated with ´or´. For example:
[DataItem] like ('abc') or
[DataItem] like ('ijk') or
[DataItem] like ('xyz')
If you have the keyword data in an excel spreadsheet starting in A1, you can use the below formula to speed up the process, then just copy and paste it into a filter.
="[DataItem] like ('"&A1&"')"

Related

Read embedded data that starts with numbers?

I have embedded data that I have imported into Qualtrics use a web service block. The data comes from a .json file and reads something like 0.male, 1.male, 2.male, etc.
I have been trying to read this into my survey using the Qualtrics.SurveyEngine.getEmbeddedData method but without luck.
I'm trying to do something that takes the form.
let n = 2
Qualtrics.SurveyEngine.getEmbeddedData(n + ".male")
but this has been returning a NULL result. Is it possible to read embedded data that starts with a number?
Also see:
https://community.qualtrics.com/XMcommunity/discussion/15991/read-in-embedded-variables-using-a-loop#latest
The issue isn't the number, it is the dot. getEmbeddedData() doesn't work when the name contains a dot. See https://stackoverflow.com/a/51802695/4434072 for possible alternatives.

Extract items in a list using variable names in R

I'm parsing a JSON using the RJSONIO package.
The parsed item contains nested lists.
Each item in the list can be extracted using something like this:
dat_raw$`12`[[31]]
which correctly returns the string stored at this location (in this example, the '12' refers to the month and [[31]] to day).
"31-12-2021"
I now want to run a for loop to sequentially extract the date for every month. Something like this:
for (m in 1:12) {
print(dat_raw$m[[31]])
}
This, naturally, returns a NULL because there is no $m[[31]] in the list.
Instead, I'd like to extract the objects stored at $`1`[[31]], $`2`[[31]], ... $`12`[[31]].
There must be a relatively easy solution here but I haven't managed to crack it. I'd value some help. Thanks.
EDIT: I've added a screenshot of the list structure I'm trying to extract. The actual JSON object is quite large for a dput() output. Hope this helps
So, to get the date in this list, I'd use something like dat_raw$data$`1`[[1]]$date$gregorian$date.
What I'm trying to do is run a loop to extract multiple items of the list by cycling through $data$`1`[[1]]$..., $data$`2`[[1]]$... ... $data$`12`[[1]]$... using $data$m[[1]]$... in a for loop where m is the month.
Instead of dat_raw$`12`[[31]], you can have dat_raw[[12]][[31]] if 12 is the 12th element of the JSON. So your for loop would be:
for (m in 1:12) {
print(dat_raw[[m]][[31]])
}

Using Marklogic Xquery data population

I have the data as below manner.
<Status>Active Leave Terminated</Status>
<date>05/06/2014 09/10/2014 01/10/2015</date>
I want to get the data as in the below manner.
<status>Active</Status>
<date>05/06/2014</date>
<status>Leave</Status>
<date>09/10/2014</date>
<status>Terminated</Status>
<date>01/10/2015</date>
please help me on the query, to retrieve the data as specified above.
Well, you have a string and want to split it at the whitestapces. That's what tokenize() is for and \s is a whitespace. To get the corresponding date you can get the current position in the for loop using at. Together it looks something like this (note that I assume that the input data is the current context item):
let $dates := tokenize(date, "\s+")
for $status at $pos in tokenize(Status, "\s+")
return (
<status>{$status}</status>,
<date>{$dates[$pos]}</date>
)
You did not indicate whether your data is on the file system or already loaded into MarkLogic. It's also not clear if this is something you need to do once on a small set of data or on an on-going basis with a lot of data.
If it's on the file system, you can transform it as it is being loaded. For instance, MarkLogic Content Pump can apply a transformation during load.
If you have already loaded the content and you want to transform it in place, you can use Corb2.
If you have a small amount of data, then you can just loop across it using Query Console.
Regardless of how you apply the transformation code, dirkk's answer shows how you need to change it. If you are updating content already in your database, you'll xdmp:node-delete() the original Status and date elements and xdmp:node-insert-child() the new ones.

How do i map one shortcut key to a sequence of tags (tasks) in lighttable?

Say, for example, I want to bind a key "ctrl+d" to duplicate current line in LightTable. For that, to emulate duplication of the current line, I want to run a series of actions like [:editor.select-line :editor.copy :editor.selection.clear :editor.new-line-indent :editor.line-start :editor.paste]
How do I achieve this?
Note: I am aware of the :editor.sublime.duplicateLine tag which duplicates the line, but this is just the example. In general, I want to map a shortcut to a sequence of tags/tasks.
http://lighttable.com/
Are you trying to bind the key? You seem to have most of it set. Just open up user.keymap (ctrl-space "user keymap") and add this:
[:editor "ctrl+d" :editor.select-line
:editor.copy
:editor.selection.clear
:editor.new-line-indent
:editor.line-start
:editor.paste]
There is no requirement that you put it on separate lines like that of course.
Or are you asking for something more complicated?

How to pass R variables as input to SearchES method in ElasticSearch?

I am working with RElasticSearch package in R. I am able to connect to the proper index in ElasticSearch. Suppose my index contains two fields like id and name. Two of my R variables,say rid and rname contains the value i want to search. How should i use the searchES method to accomplish this? I have tried using like:
searchES(server=es.index,query="id":rid & "name":rname)
but it keeps throwing an error! Can someone please help me out?
You need to correctly build your as a character value in order for this to work. In order to concatenate strings in R, you should use paste(). For example
searchES(server=es.index,query=paste0("id:", rid, " AND name:", rname))

Resources