I'm missing functionalities on SubSonic 3 - subsonic

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.

Related

how do i correctly set up a parameterized information link in spotfire?

Also posted on super users:
I'm a spotfire novice trying to create a parameterized info link. Ultimate goal is to create a default template that may be customized to return specific rows in a very large table. I've not been able to cobble together enough information from online searches to get me from point A to Z.
Spotfire version is 7.11 on an Oracle 11.2 SE DB.
Currently I've got a date/time prompt in the info link that will be global to all users. What I need is to be able to further filter to 1 of 2 columns (one is real, the other a string) in order to minimize loading times. There are 17 other on-demand tables that are related to the main one. Limiting the initial query will greatly speed up performance.
In information designer for the information link, if I edit the SQL in the WHERE and explicitly define the value or string for the column, I get the rows I want. When I try to define it using an input parameter (?ParamName), I either get nothing when I reload or get asked to input a parameter "for testing".
Q1: In the document properties for the analysis, I've been adding in properties that I assume is supposed to get picked up by the query.
- What part do scripts play in passing this variable to the SQL?
- Do I just need to define a value for a property name or include a IronPython script? - If script is required, can I just define the parameter to pass?
Q2: In the info link SQL, what is the correct syntax for defining the parameter variable depending on the type (real v string)? If I use a string, I need to include LIKE in order to pick up the desired rows. If I use a real, is it possible to define it as a list of values?
Thanks in advance.
Though not exactly clear from your description, I think you should be able to accomplish your goals using the "Load on demand" dialog that is accessed either when you add your data table to your analysis, or subsequently using the Data Table Properties>Type of Data>Settings dialog.
Spotfire uses this dialog to dynamically modify your SQL. Thus, you do not need to explicitly include the LIKE statement in your SQL. Spotfire will add it in based on what you define in the On-Demand settings. For example, you could have an Input Field where you type a constraint that will be stored as a Document Property and then refer to that Document Property in your On-Demand settings to control the table loading.

Kentico 11 System Generated GUID

Using Kentico 11 (Portal engine)
I would like to add a GUID field to one of my pagetypes. I would like the system to generate the guid (I assume this is done via a macro?). Any idea what macro might do the trick? Any help is appreciated.
I do not believe there is a macro which will generate a new GUID for you. You'd have to create a custom macro method to do that for you. The macro you're using won't work because the document isn't created at the time the macro is accessed. AND it wouldn't be unique either.
I had the same issue... I just ended up fixing it directly in SQL by adding default value:
ALTER TABLE [SomeTableName] ADD CONSTRAINT [ContraintName] DEFAULT NEWID() FOR [ColumName];
This is your custom column so you can set the value to whatever your want. I dont see any other use for GUID macro although it is not complicated thing to do.
For others that stumble upon this question in need of an auto-populating unique identifier field, I chose to use existing macro functions to piece together a unique string. This was a more appealing solution than going down the build-your-own macro path.
Here is the macro I used in the Default value field:
{% String.FormatString("{0:yyyyMMddhhmmssfffff}", CurrentDateTime) + Math.GetRandomInt(10000, 99999) #%}
Here's an example value:
201912200958109206631318
No, it's not technically a GUID. It does the job, though.

Segmented Keys in ACUMATICA

I’ve created new Segmented Keys in ACUMATICA for use in a specific module. I would like to assign the Dimension name dynamically but I noticed it works only with hard code or name like [PXDimension(“VENDOR”)]
Also, I have some limitation to create an IF Conditional inside the customized field… it does not recognize the IF clause (see the image).
I would appreciate any suggestion how to solve this issue.
I haven't seen how your original attempt at PXDimension looked, but I'm going to take a guess and assume you tried to reference a new custom field contained in a setup table, something like:
[PXDimension(typeof(XXMySetup.usrMyCustomField))]
If that's indeed what you tried to do, one very important thing to do is to ensure that you have a view for your table in your graph, otherwise the attribute will not find the table and record in your cache. For instance:
public PXSetup<XXMySetup> XXMySetup;
Without this view declared in the graph, the dimension attribute will not work as expected. It would be nice if a clear exception was thrown in this case - I made the same mistake recently and it would have been helpful.

Liferay service builder get last modified

Somebody know how to get the last row modified from a table?
For example:
I have a Service Builder with a "Car" entity, this entity has a column called "LastModified". I want something that get the one "Car" (the last cart modified).
I don't know if create a finder with where clause is a good practice.
Thank you!
First off, service builder entities have a column called "modifiedDate" by default. Just want to make sure you're aware of that so you aren't creating redundant columns: "LastModified" and "modifiedDate".
Secondly, you could use either a custom SQL query or a dynamic query to get the Car with the most recent modifiedDate. Both approaches are documented:
https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/developing-custom-sql-queries
https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/leveraging-hibernates-criteria-api
Personally, I'd try the dynamic query approach (leveraging hibernate's criteria API) first. I think it's slightly simpler.
In your finder method, you could do something like this:
Order order = OrderFactoryUtil.desc("modifiedDate");
DynamicQuery carQuery = DynamicQueryFactoryUtil.forClass(Car.class).addOrder(order).setLimit(0, 1);
List<Car> cars = CarLocalServiceUtil.dynamicQuery(carQuery);
The setLimit(0, 1) limits the result of the query to only the first Car.

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

Resources