#DbLookup To Find Column - xpages

I'm trying to use an #DbLookup in my XPage app to pull data from a column in another application. The application filename that I'm wanting to call is: aApplications\HCHPhoneBk.nsf but I'm not sure how the structure for the #DbLookup would go. It's located on a server called: DomApps01/Hendricks and the column I am wanting to get is the 2nd one.
This is what I have now, and it's not working.
#DbLookup("";"HRH Phone Directory":"aApplications\HCHPhoneBk.nsf";"People";

The syntax for #DbLookup() is:
#DbLookup([server, path], view, key, column)
So in your case it should look something like this:
#DbLookup(["DomApps01/Hendricks", "aApplications/HCHPhoneBk.nsf"], "People", key, 2)
...where "People" is the view you want to search and key is the search value for the first column. If you just want to retrieve all the values in the second column without filtering it by the first column, use #DbColumn instead of #DbLookup; the syntax is identical, except you would omit the key parameter.
P.S. Note the use of / instead of \ in the application path. \ is an "escape character" in JavaScript, so in this syntax, / is preferred.

Related

Multi LookUp - Check for unique values

I´m trying to set up unique values in my PowerApp-Form. The data is stored in a Sharepoint list. I have a column called watches, items in this column have a unique number, which have to be unique. People can pick multiple of those watches in a LookUp-field. But before submitting the form, I need to check if those picked values already exist in my list and at least display an error message.
I have setup a regular text field and added following rule to it:
If(LookUp(MyList.Watches;DataCardValue4.SelectedItems.Value in Watches;"OK")<>"OK";"No Error";"Watch already exist")
DataCardValue4 is my LookUp field, where people can pick those watches. With this rule I want to check if a item already is in my column watches and let my text field display the error. Somehow the rule doesn´t work.
Can you tell me how I compare multiple lookup choices to my table/column entries?
The first parameter to the LookUp function should be the table (SharePoint list) rather than the column. So the first parameter should be 'MyList' rather than 'MyList.Watches'. Also, I'm not sure that the formula provided (second parameter to LookUp) will work. In your formula, you will be looking for multiple items (DataCardValue4.SelectedItems.Value) within multiple items (Watches). Perhaps you can update your app to have users only pick one watch value before submitting?
One last thing to note. I'm not sure how big you expect your SharePoint list to get, but I would highly recommend keeping your LookUp formula within the bounds to support delegation. More specifically, SharePoint has different formula requirements than other connectors. For example, you can use '=' in your formula, but not 'in'.
Your new rule might look something like below. Please note that it could have syntax errors and might not even be delegable in it's current form since I am providing the rule with no checking. Also, I switched from using LookUp to using Filter instead just because I'm more familiar with Filter. However, both functions are very similar.
If(CountRows(Filter(MyList; DataCardValue4.Selected.Value = Watches)) > 0; "Watch already exist"; "No Error")

how to get all values from dropdown from web application in blueprism

I want get all values of dropdown and want to store them somewhere. from follwing NASDAQ site https://www.nasdaq.com/symbol/ge/historical i want get all values of Timeframe and want to somewhere so that i can use those values one b one in loop and get the values of stock for all timeframe. Click below image screenshot
It's not that easy to get each of the values, but it's not impossible. First you can get all the values in a Data Item as text. If you spy the element, you will notice that the attribute Value contains what you want. So you will need to use a read stage and get this specific attribute's value (you can ignore the PDF elements):
Doing so will give you the following:
The problem with this is that you cannot use this in a loop. One way around would be to split on space:
And the resulting collection (I called it Split Values) will look like this:
But it's not quite there yet. You should however be able to use this collection to get the collection you need (or use it directly).
If you use it directly, I would say it should look like this:
Empty? has the expression [Split Values.words]="" (notice the last row is blank)
Value is number has the expression IsNumber([Split Values.words])
Set Current Item as Number has expression [Split Values.words] with store value Current Item.
Append word to Current Item has expression [Current Item]&" "&[Split Values.words] with store value Current Item.

How to make a fuzzy filter in Power Query according to a list

I want to filter a Power Query table according to another list:
The fact table is:
Location Name
MEL/1F/101 zmel
SHA zsha
BKK/2F zbkk
SGN zsgn
And the lookup list is
{"BKK","SHA"}
The result I want is
Location Name
SHA zsha
BKK/2F zbkk
Now I use
l={"SHA","BKK"},
b=Table.SelectRows(#"Expanded Column1", each List.Contains(l,[location]))
but the BKK/2F is omitted, only SHA shows.
Does any one knows to correct this? Thanks.
You can create a new column using conditional Column by referencing to the table column that contains SHA & BKK. Replace the Column Name to your column.
You can use fill down function if you want to get rid of the nulls.
Update
For your case you might want to use the operator begins with since your BKK has extra text behind

find and return Urls from Note column in table

I have a sqlite database with a column (Note) and this contains a variety of content.
Some rows have Urls in them and I want to get a list of these.
I can find them like this:
SELECT SUBSTR(Note,'http') FROM PersonTable WHERE Note LIKE 'http%'
But this returns the whole string in the Note column when it finds a Url. What I want is to return only the URL nothing else.
I know this must be simple for anyone familiar with SQL but its new to me.
Thanks
The SUBSTR function expects its second parameter to be the start position; 'http' will just be interpreted as 0.
SQLite has no built-in function that would allow to find the end of the URL; you should split the returned column value in your program.

Translating strings postgres

I'm trying to translate 2 types of data using only postgres SQL
I've got a column "type" that may contains the kind of data.
type is a string column and may have "ACTUAL" or "OLD" values
+-type-+
+ACTUAL+
+OLD +
+------+
when I show the list with a lot of other joins I would like to show only "A" or "O" values
I couldnt find other way to do this than:
SELECT replace(replace(mytable.type, 'ACTUAL', 'A'),'OLD', 'O');
With that I can replace the text the way I need,
but I was looking for some more function using an array as parameter.
something like a cross-reference simple function:
translate(['ACTUAL','OLD'], ['A','O'])
Does anyone know a way to do this that doesn't use SQL views and neither needs another table like joining the results of this value with other table?
Thanks in advance,
Andre
I would use something like CASE...
SELECT
(CASE type
WHEN 'ACTUAL' THEN 'A'
WHEN 'OTHER' THEN 'O'
ELSE '?' END)
FROM
Using this method, you can return whatever you want based on whatever criteria you want, not just sub-stringing.

Resources