Skip to main content
Question

Inner join when referencing connecting entities in projection

  • February 20, 2025
  • 6 replies
  • 100 views

Forum|alt.badge.img+4
  • Do Gooder (Customer)

I’ve got a question about the SQL statement generating by projections when there’s a reference involved. It’s heavily simplified from TransportTaskLinesList.projection:

@Override
entity TransportTaskLines using TransportTaskLine {
crud = Read, Update, Delete;
attribute PartNo Text {
editable = [false];
}
...
reference InventoryPartRef(FromContract, PartNo) to InventoryPart(Contract, PartNo);

}

When we use this, the generate select statement is going to look like this (again heavily simplified:

SELECT A0.transport_task_status_db   A0_transport_task_status_db
....
FROM (SELECT A.*
FROM (SELECT TRANSPORT_TASK_STATUS_DB transport_task_status_db,
order_type_db order_type_db,
transport_task_id transport_task_id
...
FROM TRANSPORT_TASK_LINE
WHERE (objid IN
(SELECT column_value
FROM TABLE(Transport_Task_Lines_Handling_SVC.Rd_Get_Transport_Task_Lines(....))))) A) A0
LEFT OUTER JOIN (SELECT AA1.*
FROM (SELECT description_in_use description_in_use,
NULL objgrants,
contract contract,
'InventoryPart' luname,
'CONTRACT=' || contract || '^' ||
'PART_NO=' || part_no || '^' keyref,
part_no part_no,
contract objsite
FROM INVENTORY_PART) AA1) A1
ON ((A0.from_contract = A1.contract AND A0.part_no = A1.part_no))
LEFT OUTER JOIN (SELECT AA2.*
FROM (SELECT description description,
NULL objgrants,
'ConditionCode' luname,
'CONDITION_CODE=' || condition_code || '^' keyref,
condition_code condition_code
FROM CONDITION_CODE) AA2) A2
ON ((A0.condition_code = A2.condition_code))
ORDER BY A0.transport_task_id ASC, A0.line_no ASC
FETCH FIRST 25 ROWS ONLY

 

You can see two LEFT OUTER JOINS, but in this case, this is probably not what we want. There’s always an InventoryPart, it could be a simple INNER JOIN.

This would be a lot nicer regarding the performance, more than 100 times faster in our case.

I understand that in same cases, a reference is optional an outer join is what we need, but if the related entity is a parent entity, we can use an inner join and we would get a better performance across I don’t know how many projections.

Is there an option I missed or something to change this behaviour?

I noticed this in 24R2.

6 replies

PhillBronson
Hero (Customer)
Forum|alt.badge.img+11
  • Hero (Customer)
  • February 20, 2025

@Remo good question


Forum|alt.badge.img+4
  • Sidekick (Customer)
  • February 26, 2025

Hi Remo

We are facing the same problem i.e. with transport tasks that run in a timeout due to left outer joins to inventory parts (that always exist for a transport task). 

Would you create an idea for this topic and I would upvote it? If not, I will create an idea, this is a no go for us, functionality not working.

Many thanks for a reply.

BR, Daniel


Forum|alt.badge.img+4
  • Author
  • Do Gooder (Customer)
  • February 26, 2025

Forum|alt.badge.img+6
  • Sidekick (Partner)
  • November 6, 2025

Hello,

I have also an Issue with the generated LEFT JOINs.

I have 3 references, that point to Query Elements in my Projection


Interestinly the first two (yellow) will generate a LEFT OUTER JOIN in the main SQL when calling the page and the third (red) one will not. I could not figure out why it is not generating the LEFT JOIN for the third one, but I would like to have manual control of that via some parameter (e.g. check [true|false]). 
In fact I do not want the LEFT OUTER JOIN for the reference to be generated - the Client should just show the stored value “stupidly”. In my oppinion there is no check needed, since I have a LOV that only displays valid values to select from.

 


Forum|alt.badge.img+4
  • Author
  • Do Gooder (Customer)
  • November 6, 2025

@flestephs interesting! Did you check the attributes on all columns (source and target entity)? I can only imagine that IFS uses an INNER JOIN if all fields are mandatory. However, in my example both columns (FromContract and PartNo) are required and I still get a LEFT JOIN.

 

A manual control would be great, but knowing how IFS decides what kind of JOIN to use, might give us a workaround. 


Forum|alt.badge.img+6
  • Sidekick (Partner)
  • November 6, 2025

@Remo 
Alle referenced columns are fine. All are mapped and result in unique result, but it dies not generate an INNER JOIN for the third reference, it does not generate one at all.

For the “CDrawingPosNoRef” the excecuted SQL in browser just selects the stored value of the MrbPartInsDetail entity for display - no JOIN at all to CDrawingNoQuery is generated.

For the two first referenced the generated SQL contains LEFT OUTER JOIN to CPartSerialQuery for each reference.