Parsing Parameter to UI Macro

Flexit
Tera Contributor

I will try my best for explaining my problem.


So my task is to implement a UI Macro that opens a new tab.

The tab will open the list with a filter on it of the current form where the macro has been placed.

My problem is that i wanna implement it for many fields, so for example

You have Field1 and next to Field1 is the ui macro, if u press the ui macro it should open the new list with filter1

If you press the UI Macro next to Field2 it should  open the new list with filter2 and so on with Field3

 

So basicly i dont want to create for each field a UI Macro, i just want to parse parameters so the script in the ui action can evaluate wich filter should be set for the list.

 

Is this possible or do i need to create for each field a UI Macro?

for more kontext i will provide my current code but please dont hate me its my first time with ui macros and i tried some things.

(By the way i learned that i can attach the UI Macros on the fields in the Dictonary in Attributes. It would have been so much easier if you just could parse there the parameter)

 

Flexit_1-1701780074781.png

 

 

 

 

1 ACCEPTED SOLUTION

-O-
Kilo Patron
Kilo Patron

As the UI Macro is evaluated it will have in its context variable ref which will be the name of the field.

So instead of ${field} you would write ${ref}.

If you want to "hack it" just look in sys_dictionary for records where field Attributes contains text ref_contributions, which will have a value after it which will be the name of a UI Macro.

Studying those UI Macros will reveal way more about how field decorators should be implemented; at least as far as Core UI goes.

View solution in original post

3 REPLIES 3

-O-
Kilo Patron
Kilo Patron

As the UI Macro is evaluated it will have in its context variable ref which will be the name of the field.

So instead of ${field} you would write ${ref}.

If you want to "hack it" just look in sys_dictionary for records where field Attributes contains text ref_contributions, which will have a value after it which will be the name of a UI Macro.

Studying those UI Macros will reveal way more about how field decorators should be implemented; at least as far as Core UI goes.

Flexit
Tera Contributor

thanks i will try it

You're welcome.

Thanks for marking the solution.