Skip to main content
Question

Drag and drop direction

  • November 27, 2025
  • 7 replies
  • 29 views

Forum|alt.badge.img+5

I don’t understand the drag and drop interface.

I have a table “ams_location_object” and both a list and a tree view, in both the same happens.

I select and item A, and I go to the side bar, drag another item B, onto an item C.

I would expect that I get task parameters from B and C (I don’t know which one should be the task parameters and which one the drag drop parameters, that is the second question), but I do get task parameters for B and A. I don’t get anything from C.

Trying it with an other setting I found that the task is from the target.
So; task parameter = drop target, drag drop parameter = drag source.

But I somehow don’t get the item I dropped on, but the selected item as parameter. That is only useful if you drop on the table, not on a row. 

It should work as you can reorder items in the software factory. Here I want to assign the parent on drop, so that reorganizing the tree view can be done without editing items.

Please help, I thought I could speed up a little reorder job, but I’m stuck for a couple of hours.

7 replies

Mark Jongeling
Administrator
Forum|alt.badge.img+23
  • Administrator
  • November 27, 2025

Hi Daan,

Not sure if possible but could you provide an image or GIF what you are trying to do? Is it similar to reordering columns in the Software Factory for example?

I did reply to a similar question in the past: 

 

Hope this helps!


Forum|alt.badge.img+5
  • Author
  • Sidekick
  • November 27, 2025

Yes here are some images;

 


I have “Hemathology lab” selected, now I go to the dots on the side and drag LAB on HQ.

The resulting task is;

 


I just got the correct task once, but that seemed a coincidence. I keep getting the selected task instead of the drop target all the time.


Forum|alt.badge.img+5
  • Author
  • Sidekick
  • November 27, 2025

Maybe a bug in 2025.2.12.3.0?


Forum|alt.badge.img+5
  • Author
  • Sidekick
  • November 27, 2025

It works if I drag really quick, if I drag slow it becomes the selected item.

Maybe caused by the fact that there is also a form on the screen. I see that the form gets an highlight.


Forum|alt.badge.img+5
  • Author
  • Sidekick
  • November 27, 2025

Hi Daan,

Not sure if possible but could you provide an image or GIF what you are trying to do? Is it similar to reordering columns in the Software Factory for example?

I did reply to a similar question in the past: 

 

Hope this helps!

Hi Mark, I looked at your example which uses XML, is it required to use XML to perform a drag and drop?

It seemed that it could just be a task, and I don’t really feel like rebuilding it to XML, without having an actual guideline on what I’m doing.

 


Mark Jongeling
Administrator
Forum|alt.badge.img+23

Hi Daan, 

The XML stuff is only needed if you were to drag multiple rows. If you only drag one, no XML required as far as I know.

I'll try and make a simple example to see if I can reproduce the scenario at hand. This will be done with the Universal GUI version 2025.3.12.


Mark Jongeling
Administrator
Forum|alt.badge.img+23

Hey Daan, I managed to get it working. I think I do understand why it felt clunky, you have to start dragging from the drag-icon onto a drop-row. Dragging from and dropping onto the drag-icon does not work all the time.

Drag-drop working

The SF configuration is a lot to explain, but I'll do my best:

Prerequisites:

  • Table/View with PK
  • Task going to used for drag-drop
  • Logic → Task code

Table/View should have a unique PK and a field that is sorted on, typically something called order_no. This order_no is best if it has some gaps in between, like an increment of 10 for example. It will make our logic easier to make.

Example table structure

The Task should have the PK of the table + the (last) PK column of the drop record. This is so we can grab the unique drag record and drop it on the unique drop record.

Task configuration

The Table task binding may be surprising, you only need to bind the PK of the drop record:

Tab task configuration

 Why is that? Well, we are actually executing the task on the dropped record with additional information from the dragged record. To fill lthe drag_id parameter, we need to go to Subjects > Links > Drag-drop:

Drag-drop configuration

And map the drag_id to the correct column of your table:

Drag-drop parameter

If you also see Pass as value for the drag column, then it is correct!

One thing I also forgot, you do need to enable the Drag-drop interaction for your table (variant), otherwise it cannot be used.

Enabling the drag-drop interaction

And enable Default drag-drop enabled in Subjects for your table (variant):

Default drag-drop enabled

The logic is fairly simple:

Logic for the code

Code in text:

-- Get the order no of the drag and drop records
declare @drag_order_no id,
@drop_order_no id

select @drag_order_no = order_no from grocery_list g where id = @drag_id
select @drop_order_no = order_no from grocery_list g where id = @drop_id

-- Update the order no of the dragged record
---- Place is below the dropped record if the dragged record had a higher order no
---- Place it above the dropped record if the dragged record had a lower order no
update g
set order_no = @drop_order_no + iif(@drag_order_no > @drop_order_no, -1, 1)
from grocery_list g
where g.id = @drag_id

-- Recalculate all record
;with recalc as
(
select id, order_no, row_number() over(order by g.order_no) * 10 as new_order_no
from grocery_list g
)
update g
set order_no = g.new_order_no
from recalc g

 

This should be enough information to recreate this drag-drop example in your application. Like I mentioned ealier, this only works when dragging one row. If you would want to drag multiple, then the XML stuff is required, making it a bit more tricky - you could then refer to the earlier mentioned topic.

Hope this helps!