Data from right table does not show using Left Join in Dev Studio - endeca

Im using Endeca Dev studio to perform a left join. I have record adapters Items and ItemDetail with unique key itmno which im using for a Left join. Followed all the doc steps.
1) Create both record adapters
2) Create Cache for ItemDetail and add itmno in index
3) Create record assembler, specify itmno as key for Items and ItemDetailCache in Left Join setting.
I dont get any errors but data from ItemDetail doesnt show up in the jsp app. Im new to this so any guidance will really help.
Thanks

A debugging tip - either add an output record adapter after each step or run forge with the --printRecords [number] flag. These are both techniques to capture the state of the records for debugging and review. This should help you see why the join isn't happening.

Related

SQL Database "Operation must use an updateable query" Workaround

So my basic goal is to create a database for a shopsystem, which is my task to do for my IT course. I tried to create a UPDATE-Query, that collects all the Sale Positions ("tblPosition.PositionAnzahl") ordered with a SELECT-Query and groups it by the products ordered, to have an overview about how often each product has been sold.
I want to do this to keep track of how many items are still left in the inventory.
The Query was supposed to update 1 field ("tblArtikel.ArtikelVerkauft") in my table "tblArtikel", in which all my articles and their information is stored.
However, i just found out that you cannot run UPDATE-Queries, that use SELECT-Query data, as i get a error, that says "Operation must use an updateable query".
This is the code i used for the query:
UPDATE tblArtikel as a JOIN
(SELECT p.PositionArtikelID, Sum(p.PositionAnzahl) AS SumOfPositionAnzahl
FROM tblPositionen as p
GROUP BY p.PositionArtikelID
) p
ON a.ArtikelID = p.PositionArtikelID
SET ArtikelVerkauft = p.SumOfPositionAnzahl;
Is there another way to keep track of all the Items left in my inventory, apart from doing what i did?
Here are screenshots of the 2 tables (the depending fields are circled red):
tblPositionen with field PositionAnzahl
tblArtikel with field ArtikelVerkauft
I have not worked with SQL before and only learned about it during 45 min, so ther emight be an easy way for this, but i would still appreciate every answer from you guys.

Oracle Application Express SQL Query to show meaningful information

I am trying to write a query that 1) works and 2) shows meaningful information.
However, I can't seem to complete both scenarios. Both bits of code do work to a degree. My SQL query does work by showing all the useful information a user wants but when you click the edit button it doesn't link properly so it won't allow the user to update that row. The other shows only keys and rowid but when you click edit does show the information and allows it to be updated.
So as not to get another down-voted question, I have taken pictures of each scenario to show the problem, but, ultimately, I need to show meaningful information: an id or key isn't meaningful to the vast majority of users.
Here is my code
SELECT APPLICATIONS.APP_ID, APPLICATIONS.SRN, STUDENTS.SURNAME, STUDENTS.FORENAME, APP_STATUS.STATUS, METHODS.METHOD, JOBS.JOB_TITLE, APPLICATIONS.APP_DATE
FROM APPLICATIONS
JOIN STUDENTS
ON APPLICATIONS.SRN = STUDENTS.SRN
JOIN APP_STATUS
ON APPLICATIONS.STATUS_ID = APP_STATUS.STATUS_ID
JOIN METHODS
ON APPLICATIONS.METHOD_ID = METHODS.METHOD_ID
JOIN JOBS
ON APPLICATIONS.JOB_ID = JOBS.JOB_ID;
and here are the pictures of it in action
below is the code that does not show meaningful information but does work.
select "ROWID",
"APP_ID",
"SRN",
"STATUS_ID",
"METHOD_ID",
"JOB_ID",
"APP_DATE"
from "#OWNER#"."APPLICATIONS"
If i knew how to properly use rowid i am sure this is a simple feat but i dont so if i could get any help it would be useful
//edit
who ever renamed this to Application Expression why? what i am using is Apex Application Express it was relevant information that got changed to something wrong which might make it hard for someone with a similar problem to find later.
In the second, simple query, apex can determine which table (and record) you are trying to edit.
In the first query, with the joins, it can't tell which of the five tables in query you want to edit. You probably want to have the edit link pass the primary key of the row from APPLICATIONS to the child page. You would need to build into that page any logic (lists of values etc) that map lookup tables (such as status) to the values needed in the APPLICATIONS table.

SQL query / SQL Reporting Services

Been rattling my brain for a while and I could not get pass how to do the SQL query that will show the relationship/connections between my two tables.
I'm working on an IT equipment inventory program. I have two tables;
SELECT serial_number, model, ship_dat, status FROM items_list
SELECT item_serial, connected-to_serial FROM connections
All items like desktops, laptops, monitors, etc are on the items_list table. To track down the relationship/connections of the items, I created the connections table. IE, Monitor with serial_number=Screen#1 is connected to a Desktop with serial_number=Serial#1. It works ok with my Window Form application because I
used a datagridview control to list all devices simple SQL query.
However, when trying to show the relationship/connection on SQL Reports I've ran out of ideas how to do it. I'm aiming to get the report look like below or something along the lines. I just need to show the connections between the items.
Thank you
You should be able to do this with a table in SSRS if that is what you are using. The query you would need to drive the table of all related items would be:
SELECT item_serial, connected-to_serial, mainItem.*, connectedItem.*
FROM connections
INNER JOIN items_list mainItem ON connections.item_serial = items_list.serial_number
INNER JOIN items_list connectedItem ON connections.connected-to_serial = connectedItem.serial_number
You can of course tailor the SELECT statement to your needs, mainItem.* and connectedItem.* will not give you the most descriptive column names. Using column aliases (found under column_alias here) you can give a more descriptive name to each column.
From here you should be able to use a table and create a row group on the main item (either name or serial number) to get the type of look you are looking to achieve here. I believe the Report Wizard actually has most of the functionality you are looking for and should handle the bulk of this. You may have to move some of the cells around to get the look you are going for though.

When relating 3 entities in CRM 2011 using Advanced Find only 2 entities show up in edit columns

I'm trying to create a view in CRM 2011 that will show a few columns from Customers (Account), Orders (SalesOrder), and Order Products (SalesOrderDetail). I already know I need to start at the child-most entity so under Advanced Find I select "Order Products" under Look for. When I do this I'm able to select columns from Orders but unable to select columns from Customers.
Is this even possible to accomplish in CRM?
I'm trying to create the following result set:
Account.Name,
Account.Email,
SalesOrder.OrderNumber,
SalesOrderDetail.NetAmount,
SalesOrderDetail.ShipDate
I verified that you cannot manually add a second link within a view query. To my knowledge it is also not possible to add these columns though javascript. You can get the account name in your view simply by using the account lookup on the Order. If you need for the account email to also be in the view, then I suggest you add this field to the order entity and populate it with post callout logic on the account.
I Second Zach’s idea, but suggest adding a direct relationship between customer and orderdetail . This way you can use fetchxml to show account.email or any other account.* for that matter.
The downside is you’ll need to sync order.customer changes to orderdetail.customer.
The better option is to simply create a report and show that in an iframe or a webresource.
This is not possible even if we edit the fetch xml it wont work

Create SQL Table from Random Array for WebService

I have this little project that I'm working and I got to a part where I want to do something specific but can't seem to figure out a solution that works. Basically I've created a Web Service in Visual Studio that is used for a mobile app and we wanted to add a new piece of functionality that allows the retrieval of clients from multiple users. To do this I need to be able to pass an array of values to a WHERE IN clause, which I've been finding out is pretty much not possible but the other solutions I've read (that have no real example of the process) is to create a table of the Array values and then to a WHERE IN (SELECT * from TEMPTABLE) type of scenario.
So this is where I'm stuck, how do I go about passing an array of values to my SQL statement that will then create a temp table of those values (can range from 1 to 30 values) so then I can run other queries against those values. Most of the examples I've seen have the temp table hard coded with values, but I need to be able to pass an random amount of values for that table, so if it's easier to pass them as one single string with commas is fine or if they need to be passed in a specific format I can do that as well on the iOS side before calling the Web Service, I just can't seem to figure out how to do this dynamic type of table to move on to the next portion.
EDIT (Adding some information based on Comment)
So some background information on the system and purpose to help get a better understanding of what I'm doing. The Database is a SQL Server (2008) with already existing tables and data since what I'm working on is a Mobile Application port of an existing Web Application. Two tables that I can use for example are an Agent table (for employees) and a Customer Table (for their client) and so in some cases we have Teams that can view each other's clients. So normally if I wanted to pull a list of clients from a group of agents I would use the WHERE IN statement, but for the Web Service it would need to take that group as a Variable since the Rep may want to see only a few team members or all team members (this would be an option set in the iOS App).
I don't really have code that works, and most of what I have tried I know doesn't really work so I'll put some pseudo code to explain what I want to do. At first I thought I could just do this:
SELECT C.first_name + ' ' + C.last_name as [Client Name]
FROM dbo.agent as A INNER JOIN
dbo.contact as C ON C.agent_id = A.id
WHERE (A.id IN (#RepList))
In this example, #RepList would be a string passed from the iOS App to the Web Service that contained all the ID's that were selected within the Application. As I've looked into this, I can't have a variable in a WHERE IN statement but I've read that if I create a Temp Table with the variables then I could reference it like this:
CREATE TABLE #TempTable (TempID VARCHAR(MAX))
INSERT INTO #TempTable (TempID)
VALUES (#RepList)
SELECT C.first_name + ' ' + C.last_name AS [Client Name]
FROM dbo.agent AS A INNER JOIN
dbo.contact AS C ON A.id = C.agent_id
WHERE (A.id IN (SELECT #TempTable.* FROM #TempTable))
So again, #RepList would be the list of ID's that are passed from the iOS Application over to the Web Service that will run this query. This is where I'm stuck, since I can't seem to figure out how I can pass a list of values as a Variable into the TempTable. This may end up just being an issue in Visual Studio (since I've had issues with the SQL Query Designer and it not accepting certain things that end up working in the WebService) but I want to be sure this is the right format of doing so before moving forward. In the end, the WebService needs to be able to return a list of Clients based on however many Agents the person wants to see (this can range from just 1 agent to 20 agents).
Since you are on SQL Server 2008 and VS2010, probably the best solution is to use a Table-Valued parameter. This link (here) describes how to use them from a .Net client.
The basic idea is, your webservice code will call a procedure, function or parametized query on SQL Server, where one of the parameters is a table of values. Then the SQL code will use that table-valued parameter as its source matching table instead of a temporary table.