how to getBy multi fields using LCDS - apache-flex

I am new to Flex. In my project, I use LCDS to define a holiday table which contain holidayId, countryCode and companyCode. LCDS generated all the getBy which are very handy. However, I need to get the records which are having countryCode = US AND companyCode = ABC. Surely I cannot use any of those generated getBy (each of them deals with a single field only). Can you suggest me how to modify the code in generated services (in my case, it is _Super_HolidayService.as) to handle multi-key data retrieval or point me to the right direction. Thanks.

Assuming that you're using LiveCycle's Model Driven Development, the solution is to add a filter to your Holiday entity. For example, you could add the following to the source of your Data Model (inside of your Holiday entity):
<filter name="getByCountryAndCompany" criteria="countryCode eq, companyCode eq"/>
This will create a getByCountryAndCompany method in your HolidayService that will query based on a match of both countryCode and companyCode.
Please see Adobe's Application Modeling Reference here http://tinyurl.com/7ras5yk for more information on the "filter" tag and its syntax.

Related

Entity Framework - How to return a strongly typed object containing multiple Entities?

I have three tables in SQL Server: Company, Financial and FinancialHistory.
Relationships are:
Company -> Financial (1-1)
Financial -> FinancialHistory (1-Many)
Having generated an Entity Model, I want to return one larger "Entity" that contains ALL the columns from Company and Financial and a select few from FinancialHistory so that I can maintain a sort across multiple GridViews at the front end. Basically I want to avoid returning a dynamic List type which is where i'm at currently, I want a more strongly typed return type.
Is there any feature in Entity Framework 6 that allows me to do this via the Model diagram or do I have to create my own class and use it separately to the Model? An example of the class and instructions would help.
NOTE: I flatten out the FinancialHistory data and create dynamic columns in a DataTable before assigning to GridViews.
Originally this was a Stored Procedure that used PIVOT and generated dynamic columns but I wanted to move it over to EF and use LINQ.
When querying you can project the results into any type. While that type won't be updatable (you need to directly modify entity types) it works very well when querying.
var res = await (from cpy in myDbContent.Companies
// get two newest financial results
let fin = cpy.financials
let finResRecent = fin.History.OrderByDescending(h => h.FinancialYear)
let finResLast = finResRecent.FirstOrDefault()
let finResPrev = finResRecent.Skip(1).FirstOrDefault()
select new {
Company = cpy,
Financials = fin,
LastResults = finResLast,
PreviousResults = finresPrev
}
).ToListAsync();
(Inside the query many operators – like Single – can't be used, but FirstOrDefault can)

Query Ranges in an X++ Batch Class

Can anyone tell me which method to put a Query Range into for a class which is batchable?
I have a sample batch class, which runs fine. It retrieves all the records in the Sales Table. I know that I need to add a QueryBuildRange object somewhere, then set the value of the range to a particular value (e.g. Sales ID = 00123456), but I'm not sure what method to put it in (main? Run? QueryRun? InitQuery?)
Thanks for your help!
It depends on what you're wanting to do, but in AX 2009 for batch, you can look at InventCountCreate_Base for an example of how Microsoft does it.
Specifically these two methods:
\Classes\InventCountCreate_Base\new
\Classes\InventCountCreate_Base\initQueryRun
Microsoft does it several different ways. You can see an alternative method in WMSShipmentReservationBatch in these two methods:
\Classes\WMSShipmentReservationBatch\main
\Classes\WMSShipmentReservationBatch\buildQueryRun

pro asp.net 4.5 in c# book by adam freeman sportstore

just wondering did anybody complete the sport store application in this book, i am having a problem with the data binding in the orders page for the admin, i want to pull in the product id from the order lines table but i keep getting errors, it working correctly for the quantity but i can seem to get the product id to bind. i have tried the following code but this is not working for me at the moment
**<td><%# Item.OrderLines.Product_ProductID %></td>**
it says i am missing a definition in the orderline
First of all, OrderLines is of type List most likely. So the list doesn't have a definition of Product_ProductID. You should rather make a loop for Item.OrderLines and then you can access each order line of the order with its product. At second, take a look at your OrderLine model. Does it contain Product_ProductID? Most likely it has Product property
references to Product model which contains ProductID. So after all, your code would look like:
**<td><%# Item.OrderLines[i].Product.ProductID %></td>**

Content delivery criteria for getting data from LinkInfo Table

I need to fetch component ids from link info table based where url field matches a certain value. Is there any criteria to get data from link_info table in tridion using content delivery api.
for example
Regards,
Rajendra
Components don't have URLs, so that might be a bit tricky to achieve.
Pages do have URLs, and you can use the PageFactory class to find them, something along these lines:
PageMetaFactory factory = new PageMetaFactory(publicationId);
PageMeta meta = factory.getMetaByUrl(publicationId, "/my/url");
List<ComponentPresentationMeta> cpMetas = meta.getComponentPresentationMetas();
This will contain a list of all component presentations for a given page. You can use cpMeta.getComponentId() to get the component ID of the component presentation in question.
You may want to start asking Tridion questions here: http://tridion.stackexchange.com

How to filter the data provider for a tree?

I have a requirement to filter the tree similar to that of flex builder-->preferences wizard tree.
My tree dataprovider is arraycollection of industries. Each industry has a list of sub industries and further, say upto depth 5.
So when we type in a string to filter, only the node having this string along with their parent hierarchy should be returned.
How can we implement this using flex?
I would write more but I think this link is all that's needed, essentially what it comes down to is you can use a filterFunction that's able to recursively act on the collection. If you need more direction please specify where you're stuck and what your original data set looks like.
http://www.kalengibbons.com/blog/index.php/2009/01/filtering-a-flex-tree-using-an-arraycollection/

Resources