AWM. Lookup fields


#1

Hi!

I try to implement the following: generate a list of values ​​of the Database List, based on the data of another AWM.

Source class:
## SoftwareInventory.Code.SoftwareInventoryClass
## Code (code: String)
## Desc (desc: String)

Hibernate Query field filled by this query:
select doc.fullName from XWikiDocument as doc, BaseObject as obj where doc.fullName=obj.name and obj.className='SoftwareInventory.Code.SoftwareInventoryClass' and doc.fullName not like '%Template'

However, the result differs from the expected: instead of
<FieldValue>
i see
SoftwareInventory.<FieldValue>.WebHome

image

How do I write a query to display only the field value without prefixes and suffixes?
How do I specify the list of fields to display?


#2

upd:
Way 2:

image
image
image


#3

Hi to all!

Somewhat clarify a little: the value I specified in the screenshot occurs due to violation of the integrity of data between tables in two cases:

  1. Edit the field that has the deactivated Relational Storage option;
  2. Delete the entry from the source table.

Case 1 is easy to process: Relational Storage must always be enabled.
Case 2 is more complicated. Actually, the question is:
how to implement Reference Constraint (as in RDBMS), which would handle the attempts to delete the data that are linked in other pages / tables / documents?

Thanks.


#4

Hi!

Another case:
AWM - Application Within Minute.

  • In AWM 2 create a record (DB LIST field type), which refers to the data in AWM 1.
  • In AWM 1 remove the data.
  • In AWM 2 they are still present in lookup.

When I start the HQL selec manually - there is no data, everything is ok:

select concat(' [ ', softName.value, ' ', softVersion.value, ' ] ') 
from
     XWikiDocument as doc,
     BaseObject obj,
     StringProperty softName,
     StringProperty softVersion
 where doc.fullName=obj.name and
     obj.className='SoftwareInventory.Code.SoftwareInventoryClass' and
     softName.id.id=obj.id and softName.name='softName' and
     softVersion.id.id=obj.id and softVersion.name='softVersion' and
     doc.fullName not like '%Template'

How to remove them?
How to implement integrity checking?
How to add a Clear Field button?

Thanks.


#5

Hi!

The problem is solved: for correct operation it is necessary that the request return the unique key field (what I did not do) and the value field. I added a key field and everything worked fine.
Next, also need to implement the correct autogeneration of the unique ID using UIN Script Service
but that’s the next story :slight_smile: