Skip to main content

Hi everyone,

I'm trying to create a bar chart forecast in IFS Lobbies that shows the total net amount of planned spares (SUM(UNIT_PRICE_INCL_TAX * QTY_INVOICED)) grouped by custom delivery periods rather than standard calendar months.

We have predefined customer order delivery months (e.g., "Jan-25", "Feb-25"), each covering specific date ranges rather than full months. I need to map planned delivery dates to these periods for proper grouping and display them on the X-axis of the chart.

 

Here’s the query structure I’m using:

 

-- Name: 
Customer Order Forecast Per Month

-- View: 
&AO.CUSTOMER_ORDER_LINE

-- Where:
EXISTS (
    SELECT 1 
    FROM (
        SELECT '01/01/2025' AS start_date, '01/01/2025' AS end_date, 'Year Opening Period 2025' AS period FROM DUAL
        UNION ALL SELECT '01/01/2025', '24/01/2025', 'Jan-25' FROM DUAL
        UNION ALL SELECT '25/01/2025', '21/02/2025', 'Feb-25' FROM DUAL
        UNION ALL SELECT '22/02/2025', '24/03/2025', 'Mar-25' FROM DUAL
        UNION ALL SELECT '25/03/2025', '23/04/2025', 'Apr-25' FROM DUAL
        UNION ALL SELECT '24/04/2025', '22/05/2025', 'May-25' FROM DUAL
        UNION ALL SELECT '23/05/2025', '23/06/2025', 'Jun-25' FROM DUAL
        UNION ALL SELECT '24/06/2025', '23/07/2025', 'Jul-25' FROM DUAL
        UNION ALL SELECT '24/07/2025', '21/08/2025', 'Aug-25' FROM DUAL
        UNION ALL SELECT '22/08/2025', '23/09/2025', 'Sep-25' FROM DUAL
        UNION ALL SELECT '24/09/2025', '24/10/2025', 'Oct-25' FROM DUAL
        UNION ALL SELECT '25/10/2025', '21/11/2025', 'Nov-25' FROM DUAL
        UNION ALL SELECT '22/11/2025', '31/12/2025', 'Dec-25' FROM DUAL
        UNION ALL SELECT '31/12/2025', '31/12/2025', 'Year Closing Period 2025' FROM DUAL
    ) delivery_periods
    WHERE planned_delivery_date BETWEEN TO_DATE(start_date, 'DD/MM/YYYY') AND TO_DATE(end_date, 'DD/MM/YYYY')
)
AND objstate != 'Cancelled' 
AND contract LIKE NVL(UPPER('$SITE$'),'%')
AND company LIKE NVL(UPPER('$COMPANY$'),'%')
AND customer_no LIKE NVL(UPPER('$CUSTOMER_NO$'),'%')
AND &AO.Customer_Order_API.Get_Authorize_Code(order_no) LIKE NVL(UPPER('$COORDINATOR$'),'%')

-- Order By:
TO_DATE(start_date, 'DD/MM/YYYY')

-- Group By:
period

-- Columns:
Count (order_no) -- Order Lines
Count (Distinct(order_no)) -- Orders
period -- Delivery Month
SUM(UNIT_PRICE_INCL_TAX * QTY_INVOICED) -- Total Net Amount
 

I am new to IFS and this style of development, but my knowledge of SQL is very good.

 

Any advice or insights would be greatly appreciated! Thanks in advance.

Maybe using an IAL would be your quickest solution? (Although they are going away at some point)

 

I would suggest using query designer but it’s frustrating and likely can’t do it.

 

you might be able to do it by getting clever with a case statement in the attributes of the lobby data source. But you’ll probably run into challenges with the amount of things you need to check for

 

next option (my approach)…use developer studio. Lots of options there that don’t feel like hacks. So many that I’m not going to rattle them all off in this post


I’ll look into developer studio in the long term, but for now it would appear this a constraint we’ll have to work with. So far I’ve found bespoke dates like this within a query are tricky and I’m not keen on spending too much time / requiring a lot of overhead to get it to work via Datasource designer.

 

Thank you for your quick response ​@PhillBronson, definitely saves me a lot of time.


Reply