Need help in Qliksense vlookup function - qliksense

I have two excel files, where I have to pull certain columns from one excel based on the matching id in from another excel.
I have across a discussion in qliksense community (https://community.qlik.com/t5/QlikView-App-Dev/VLookup/td-p/1068404), I have tried the suggested solution, but I am still getting "Field not found" error while running the script. Below is the script which I am trying to run
Master:
LOAD
"Department Name",
"Financial Department Number",
"Lead1 Contact",
"Lead2 Contact",
"Lead3 Contact",
FROM [lib://tech/Department Master_old.xlsx]
(ooxml, embedded labels, table is [Department Master]);
RawData:
LOAD
Idea_ID,
Idea_Title,
Created_Date,
Created_By,
People_Leader,
Lookup("Lead1 Contact","Lead3 Contact",H_People_Leader,"[Department Master]"),
Description,
Comments,
FROM [lib://tech/Raw Report.xlsx]
(ooxml, embedded labels, table is Sheet5);
Here is the error I am getting
Field 'Lead1 Contact' not found
Can someone help me to resolve this issue.

Solution: This solution worked for me
Master:
LOAD
"Department Name",
"Financial Department Number",
"Lead1 Contact",
"Lead2 Contact",
"Lead3 Contact",
FROM [lib://tech/Department Master_old.xlsx]
(ooxml, embedded labels, table is [Department Master]);
RawData:
LOAD
Idea_ID,
Idea_Title,
Created_Date,
Created_By,
People_Leader,
Lookup('Lead1 Contact','Lead3 Contact',H_People_Leader,'[Department Master]'),
Description,
Comments,
FROM [lib://tech/Raw Report.xlsx]
(ooxml, embedded labels, table is Sheet5)
Note : Just replaced double quotes(") with a single quote(') in lookup function.

Related

how to get schema.org multiple keys for award category

I am trying to create a schema.org in ld+json and I have all the data working so far.
I am trying to create an array for the award field for a person so I can list multiple awards.
If I do "award" : "some award" as a solo item it works. But I am having trouble creating multiple awards.
I have tried
"award": [
{
"#type" : "award",
"name" : "award name"
}
]
But I get a validation error that award is not a known valid target type for the award property.
I have checked out schema.org and tried looking it up online, but have not found anything helpful.
Has anyone had any experience with getting this to work?
according to award's docs:
Values expected to be one of these types
Text
so, there's no #type, just plain text, so you can try listing awards as strings in an array:
{
"#context": "https://schema.org",
"#type": "Person",
"award": ["Award", "Another award", "And another one"]
}

How to stop upper() from being pulled through as part of Google Sheets QUERY?

I'm unable to find a way of making sure that upper() is not pulled through when using the QUERY function on Google, specifically with SELECT.
I have an example below:
=QUERY(countries, "SELECT UPPER(C)", 1)
But this outputs upper() as one of the cells. In this case the first item of the column is Continent so this pulls through as "upper(Continent)
Example Spreadsheet here
Does anyone know how to fix this so that upper() doesn't appear at all?
try:
=QUERY(QUERY(countries, "select upper(C)"), "offset 1", 0)
=QUERY(QUERY(countries, "select upper(C),upper(B)"), "offset 1", 0)
tho all you need is:
=ARRAYFORMULA(UPPER({C2:C, B2:B}))
or shorter:
=INDEX(UPPER({C2:C, B2:B}))
Found the answer here!
Basically you need to label the column as nothing like so:
=QUERY(countries, "SELECT UPPER(C) label UPPER(C) ''", 1)
Hope this helps someone at some point as it took me a while to find!

Mail merge: How can I format indiviidual fields within "database" field

For a mail merge in Microsoft Word from data in Microsoft Excel, I have written a DATABASE field that successfully adds all of the fields I want and dynamically changes for each mail merge record ("many to one").
I have then tried to format the numbers within this DATABASE statement, but when I used FORMAT() the number did change to the format I wanted, however the header was replaced with Expr1003.
Is there a way to format the numbers within the DATABASE statement shown below but without losing the header titles?
Code without formatting:
{DATABASE \d"{FILENAME \p}/../data5.xlsx" \s "SELECT [Accountable Officer], [Cost Centre Group], [Description], [Annual Budget], [Outturn Forecast], [Outturn Forecast Variance] FROM [data$] WHERE [Accountable Officer] = {Quote 39}{MERGEFIELD Accountable_Officer}{Quote 39} ORDER BY [Cost Centre Group] "\l \b "16" \h}
If I amend Annual Budget with FORMAT() as below:
{DATABASE \d"{FILENAME \p}/../data5.xlsx" \s "SELECT [Accountable Officer], [Cost Centre Group], [Description], FORMAT([Annual Budget], '£#,##0;-£#,##0'), [Outturn Forecast], [Outturn Forecast Variance] FROM [data$] WHERE [Accountable Officer] = {Quote 39}{MERGEFIELD Accountable_Officer}{Quote 39} ORDER BY [Cost Centre Group] "\l \b "16" \h}
then the figures shown in the Annual Budget column are formatted correctly, but the header title then changes to Expr1003 (or Expr1004, Expr1006 etc).
The reason for the change in the field name is because the function is "hiding" the fied name. In this case, the Database field is creating an expression for the field name.
One way around this is to pre-format in the data source, in the case of Excel, by turning the cell content into text instead of a number.
The other way is to assign an alias as the field name using AS:
FORMAT([Annual Budget], '£#,##0;-£#,##0') AS Budget.
I think you should be able to use AS [Annual Budget], but test this, first, to be sure the basic syntax works. My quick test in Access did not allow using the same field name as the alias, but my test in Word did allow it...

SSIS Formatting input from flat file

I'm a SSIS newbie. I wanna format the inputs of my flat file before saving the entries in a database table. Initially I created a flat file as follows:-
"1","Superman","Metropolis"
"2","Batman","Gotham"
"3","Spiderman","New York"
"4","James Bond","London"
"5","Green Lantern","Oa"
The solution for stripping this was simple as shown here http://www.mssqltips.com/sqlservertip/1316/strip-double-quotes-from-an-import-file-in-integration-services-ssis/
But now i have created a new similar package and given my input file like this:-
"6", "TMNT", "Sewers NY"
"7", "Iron Man", "New York"
Note here I've put a space after the delimiting comma. Now when I follow the above method the first number field stripped of the double quotes, but rest of the entries retain their quotes. Any idea how to work around this? One suggestion on a similar question on stackoverflow mentioned use of a "Transformation script". Since I'm a newbie can anyone please throw light on this method?
Yes, you can use Script component transformation. Select all columns, and change them to ReadWrite. The code:
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
Row.ID = Row.ID.Replace("\"", string.Empty);
Row.Movie = Row.Movie.Replace("\"", string.Empty);
Row.City = Row.City.Replace("\"", string.Empty);
}
If you want to trim the spaces you can use
Row.ID.Replace("\"", string.Empty).Trim();
You would also need to take care if you want to preserve the values that are " ". Please post if the suggestion was helpful or if you have any questions.
In the 'General' tab you can set a text qualifier of ". Then those quotes will be ignored.
Then you don't need to write error prone script when there is a simple solution.

UISearchbar results filtering

I have a UISearchBar where the user can type the text. Basically it is a dynamic company name search. (loaded from ext API) e.g. if the user has typed "MIC", it will show AMIC, BMIC, CMIC, ...MICROSOFT.
I am using the code below
NSRange titleResultsRange = [sTemp rangeOfString:searchText options:NSCaseInsensitiveSearch];
My question is;
1. Is this the best approach for filtering? i.e. For comp name should I use Name starts with OR Name contains, which is the current approach.
2. The search is not working for spaces. e.g. it returns no results for "COMP NAME"
I'll add comments for additional info as I get answers.
Please suggest.
With only one line of code to go on, it's hard to tell whether or not your search implementation is the "best approach" - providing additional info would be helpful. For example, we don't even know where the sTemp variable is coming from or what it contains.
That said:
If your results are indeed coming from an external API, it might provide you a speedup to send the search string to that API and have it do the search closer to the data source - having you cache and do a string scan on your entire result set will show some performance slowdowns as your data set size increases. If you're set on doing the search locally, though, then yes, a case-insensitive search is probably your best option.
Do you expect results for "COMP NAME"? I'm going to wildly assume that you have some company called "COMPANY NAME", and want your abbreviated "COMP NAME" search to hit on "COMPANY NAME". Then your problem here is that you're doing a compare on the entire string, not parts of it - "COMPANY NAME" doesn't contain the substring "COMP NAME", even in case-insensitive comparison. What you need to do instead is split your search string on whitespace, then check for each company if the name contains all the substrings of your query. In this example, then, "COMPANY NAME" contains both the substrings "COMP" and "NAME", so it would match.