How to: Custom icon operations in queries

Contains tips for configurators working with Aware IM
Post Reply
hpl123
Posts: 2594
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

How to: Custom icon operations in queries

Post by hpl123 »

Hi all,
This is a tip on how to create a custom icon operation solution i.e a solution where icons can be changed per row if a condition is met etc.. This can also be used to create more advanced solution like changing the "properties" of an icon operation (like in this example where, if a task is completed the "Info" icon operation is 1) faded , and 2) not active (i.e. not possible to click it).

Screenshot:
Image

Instructions:
The solution basically consists of custom rules populating a special attribute (plain text) with html code. The html code is what displays the icon operation in the query. Regarding how to change icon / operation dependant on condition, this solution simply populates the icon operation attribute with html code PER CONDITION (i.e. if it´s condition A populate with this html code, if it´s condition B populate with another html code etc.).

I have typed in code / example rules below to give you an idea of how this works.

Example, instance creation:

Code: Select all

If Task IS NEW Then 
Task.EditIcon='<a href=# onclick=AwareApp.startProcess2("myProcess","Task",<<Task.ID>>,"main")><img style=vertical-align:text-bottom; src=images/grid.png></a>' 
Task.InfoIcon='<a href=# onclick=AwareApp.startProcess2("myqProcess","Task",<<Task.ID>>,"main")><img style=vertical-align:text-bottom; src=images/information.png></a>' 
Task.DelIcon='<a href=# onclick=AwareApp.startProcess2("mydProcess","Task",<<Task.ID>>,"main")><img style=vertical-align:text-bottom; src=images/delete.gif></a>' 
Task.CompIcon='<a href=# onclick=AwareApp.startProcess2("Completed","Task",<<Task.ID>>,"main")><img style=vertical-align:text-bottom; src=images/check-unchecked.png></a>' 
Example, condition change:

Code: Select all

If Task.Completed WAS CHANGED TO 'Yes' Then 
Task.CompIcon='<a href=# onclick=AwareApp.startProcess2("NotCompleted","Task",<<Task.ID>>,"main")><img style=vertical-align:text-bottom; src=images/check-checked-gray.png></a>' 
Task.InfoIcon='<a style=pointer-events:none;cursor:none;opacity:0.3; href=# onclick=AwareApp.startProcess2("myqProcess","Task",<<Task.ID>>,"main")><img style=vertical-align:text-bottom; src=images/information.png></a>' 
ELSE
If Task.Completed WAS CHANGED TO 'No' Then
 Task.CompIcon='<a href=# onclick=AwareApp.startProcess2("Completed","Task",<<Task.ID>>,"main")><img style=vertical-align:text-bottom; src=images/check-unchecked.png></a>'
Task.InfoIcon='<a href=# onclick=AwareApp.startProcess2("myqProcess","Task",<<Task.ID>>,"main")><img style=vertical-align:text-bottom; src=images/information.png></a>' 
Henrik (V8 Developer Ed. - Windows)
Post Reply