How to select all rows from table? - slick

As subject says, how to query a table without condition (WHERE clause)?
For example, LookupTable.filter(r => true) (this doesn't work of course)
Thank you

Basically what you need to do is to use this:LookupTable.result.
In fact this is exactly one of the first code samples in Slick documentation "Getting started section" here: http://slick.lightbend.com/doc/3.1.1/gettingstarted.html#querying
As there is no code pasted in your question I can only assume that you are aware of that you need to use db.run(...) to fire you DBIO (generated by this result call).

Related

Select a Schedule (or other elements) by name instead of index number in Dynamo/Revit

I have a dynamo script that exports schedules out of Revit. It uses a bit of Python also, (not relevant to this question, but I thought I would just include it all).
It all works great, but I notice if certain schedules get deleted from Revit, it could change the "Index" number of the schedules I need to export. I would like to use the schedule name instead of the dynamo index number, as this will help me maintain the connection without checking if it's exporting the correct schedule. Is this possible?
From the pure Revit API point of view I can only answer that yes, this is possible. You are calling the ViewSchedule.Export method. The ViewSchedule element can indeed be retrieved from the Revit database by name using a filtered element collection.
Here is the final solution that works well. Using the "==" node and "List.FilterByBoolMask" node I was able to filter down to just what's in the String. Now I can set the string node to be an input for the dynamo player and user just needs to input the exact name of their schedule. Thank you Michael Kilkelly from ArchSmarter for this helpful video.
How to Dynamo: Filter List by Element Name

finding organization and industry/sector from string in dbpedia

I am generating a short list of 10 to 20 strings which I want to lookup on dbpedia to see if they have an organization tag and if so return the industry/sector tag. I have been looking at the SPARQLwrapper queries on their website but am having trouble constructing one that returns organization and sector/industry for my string. Is there a way to do this?
If I use the code below I get a list of industry types I think rather than the industry of the company.
from SPARQLWrapper import SPARQLWrapper, JSON
sparql = SPARQLWrapper("http://dbpedia.org/sparql")
sparql.setQuery("""
SELECT ?industry WHERE
{ <http://dbpedia.org/resource/IBM> a ?industry}
""")
sparql.setReturnFormat(JSON)
results = sparql.query().convert()
Instead of looking at queries which are meant to help you understand the querying tool, you should start by looking at the data which is being queried. For instance, just click http://dbpedia.org/resource/IBM, and look at the properties (the left hand column) to see its rdf:type values (of which there are MANY)!
Note that IBM is not described as a ?industry. IBM is described as a <http://dbpedia.org/resource/Public_company> (among other things). On the other hand, IBM is also described as having three values for <http://dbpedia.org/ontology/industry> --
<http://dbpedia.org/resource/Cloud_computing>
<http://dbpedia.org/resource/Information_technology>
<http://dbpedia.org/resource/Cognitive_computing>
I don't know whether these are what you're actually looking for or not, but hopefully what I've done above will start you down the right path to whatever you do want to get out of DBpedia.

management of big number of parameters of a keyword in VBscript

I'm working on test automation using keyword driven framework. I have to add a keyword add_car. This keyword needs a big number of parameters that should be entered in the excel sheet as parameters for this keyword.
I want to find a solution to manage the big number of parameters(some of them are always required and the others are optional)
The below picture is an example of how the values of parameters are entered in the Excel sheet.
excel sheet example
Here is how I call this keyword in UFT
keyword Call in UFT
And in my Functions Library, I defined the instructions of my_keyword.
Is there any solution to manage this big number of parameters(I have more than 30 parameter in general some are optional and others are always required).
I'd advise walking through your worksheet to get all parameters and store them into a dictionary. Then you would call your functions by calling the dictionary instead of all parameters individually.
The way to manage all of the parameters to add them into dictionary would have to be handled in a separate function and you could then check if the parameters exist/have values inside your functions or even externally. It would actually be kind of a whole new framework just to work with it, but when you're done, you could reuse the functions anywhere you wanted.
At least that was the way implemented in the project I've worked (though I was not the one to implement it).
It is hard to provide a thorough answer about the topic because it is pretty extensive, but for starters, I'd recommend this link about working with dictionaries:
http://automated-360.com/qtpuft/advanced-concepts/everything-dictionary-object/
In a very brief way, Dictionary objects are sort of a collection of Key,Item pairs, where you could store your parameters like Parameter1,ParameterValue to use later.
It also allows you to sort your parameters, check for existence, store them in a Case Insensitive way, edit them, delete them and so forth.
This is what I can offer to you now.
Happy research and happy coding.
Not sure how many parameters do you have.
However, I have 600+ parameters required for 1 test case (I know... It's a huge end to end test that takes loads of parameters).
I have used different tabs in excel sheet to logically separate the test data parameters.
I read the excel as database (using ADODB.connection) and query each tab in excel to get the row that I need. I can write SQL join to query from multiple excel tabs at once.
Reference on reading excel as DB:
http://www.automation.ultimatetimepass.com/index.php/home/qtp/excel/qtp-read-excel-using-adodb-connection/10-qtp-excel
Few thoughts on this.
Possible solution 1: Text File Approach
You will have all the parameters are stored with key,value combination like given below in the text file.
Parameter1=abc
Parameter2=def
Parameter3=ghi
The advantage here is when any of your parameter not needed, just remove from the text file.That being said, Your framework engine should read the keyword "ReadFile" as function and return a collection of string from file.
sParameterList = ReadFile("")
Possible solution 2:
Define all the parameters with comma separated value.Split and pass it your function call.
Parameter1=abc,Parameter2=def,Parameter3=ghi

Storing index values in FAST-ESP without modifications

first of all I'm totally new to FAST but I already have a couple of issues I need to solve, so I'm sorry if my questions are very basic =)
Well, the problem is that I have a field in the FAST index which in the source document is something like "ABC 12345" (please note the intentional whitespaces) but when stored in the index is in the form "ABC 123456" (please note that now there is a single space).
If I retrieve all the document values then this specific value is OK (with all the whitespaces), my only problem is with the way the value is stored in the index since I need to retrieve and display it to my user just like it appears in the original document, and I don't want to go to the full document just for this value, I want the value that I already have in the index. I think I need to update one of the FAST XML configuration files but I don't have enough documentation at hand in order to decide where to perform the change, index_profile.xml? in the XMLMapper file?
I've found the answer by myself. I'm using a XMLMapper for my collection, all I had to do was to add the ignore-whitespace attribute to the Mapping element and then set this attribute value to "false". This solved the problem and the raw data now when retrieved from the index contains the expected inner whitespaces.
Thanks.

I'm missing functionalities on SubSonic 3

I'm starting to do some test on SubSonic 3 and I'm missing some stuff.
1st: Where's the Table names constants? The place where we could ask for the same of a certain table using intelisense...
2nd: Same as the above but for the table columns... where are they?
This is very useful mostly when you need to pass those names as string... it you need to refactor your DB we don't need to look through all the code to find where was I using that column!! Once you re-generate the code the compiler tells you!
3rd: Now how can I perform an ExecuteReader on a certain table like I'm used to on 2.x through the Query object? I used this a lot for list where I really don't need the business objects (BO) overhead... When I needed a BO (for showing a grid row details) I create it from the row itself...
I'm using ActiveRecord btw...
Thanks guys!
Alex
1st: Where's the Table names constants? The place where we could ask for the same of a certain table using intelisense...
In Structs.tt find the following line of code at line 47:
<# foreach(var col in tbl.Columns){#>
Add the following code above it:
public static string TableName { get { return "<#=tbl.Name#>"; } }
Now you'll have a property that returns the name of the table.
2nd: Same as the above but for the table columns... where are they?
In the generated Structs.cs file, this is included in the 3.0.0.3 version
3rd: Now how can I perform an ExecuteReader on a certain table like I'm used to on 2.x through the Query object? I used this a lot for list where I really don't need the business objects (BO) overhead... When I needed a BO (for showing a grid row details) I create it from the row itself...
If you're using SqlQuery object you can call ExecuteReader on it. Alternatively you can use Linq syntax to generate return custom shaped objects and they'll get mapped automatically.
1st and 2nd: It's not implemented in the default tt-files.
A similiar question:
SubSonic 3 Simple Query Tool
Problem is that's not a correct implementation if you want the 2.x way - the XColumn properties used to be column objects and not string constants, those were found under the Columns struct. So I hope that check-in will not be accepted and that someone will 2.x-ify it correctly.
Anyway as you can see it seems pretty easy to fix it on your own.

Resources