Developer forum

Forum » Development » Packing list
Søren Christensen
Reply

Hi, I'm a DynamicWeb Newbie, but comfortable in SQL and C#.

My question is what it takes to build a reusabel list of orders/orderlines with a certain status, ordered by customers with a specific company relationship.

I could imagine a dropdown where the shopowner picks one company from a a list generated by this SQL:

   SELECT DISTINCT [AccessUserCompany] FROM [AccessUser]

..or a similar C# Linq expression, if the framework contains ORM objects for users.

The list to be generated would then hold the result of this query (or equivalent Linq expression):

SELECT U.[AccessUserName], O.[OrderID], O.[OrderDate], OL.[OrderLineProductNumber], OL.[OrderLineProductName], OL.[OrderLineQuantity]
FROM [AccessUser] U
INNER JOIN [EcomOrders] O ON O.[OrderCustomerAccessUserID] = U.[AccessUserID]
INNER JOIN [EcomOrderLines] OL ON OL.[OrderLineOrderID] = O.[OrderID]
WHERE U.[AccessUserCompany] = @PickedCompany
 AND O.[ORDERDELETED] = 0
 AND O.[OrderTransactionStatus] = 'Succeeded'
 AND O.[OrderComplete] = 'True'
 AND O.[OrderStateID] = 'OS2'
 AND OL.[OrderLineType] = 0
ORDER BY U.[AccessUserID], OL.[OrderLineProductNumber] ASC   

It would be great if the result could be grouped by AccessUserName.

Can this be achieved using lists, or does it take development of modules?

I have a running DynamicWeb site running on my Dev machine from VS2017.

Production site is running DW 9.3.11

Kind regards

Søren


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Yeah, I think you can implement this with Data Lists: https://doc.dynamicweb.com/documentation-9/content/apps/data-lists-forms-for-data-lists

Some things you'll probably need:

1. Custom templates to build up a form that shows the users and submits to the server

2. Some logic in your template to determine group (you could loop and switch to a new "group" when some value changes)

3. A request parameter to drive the second query's filter for the user ID.

Hope this helps,

Imar

 

You must be logged in to post in the forum