Menu

OQL query with Customized Request Form extension - use field value in JOIN

2023-02-17
2023-03-22
  • Giuseppe De Fazio

    Hi,
    I want get the organization used in a custom field created with the Customized Request Form extension; to do this I'm tring with this query:

    SELECT U FROM TemplateFieldValue AS V
    JOIN Organization AS U ON V.field_value=U.id
    WHERE V.field_code='Divisione'
    AND V.obj_key = 239

    (239 is the UserRequest's ID used for my tests)

    When I executed this query I got the error below:
    [cid:image003.png@01D942CC.022CC3B0]

    But if I try another query with field_value filtered in WHERE condition it works...
    Please can anyone suggest me a way to fix this problem?

    Thanks,
    Giuseppe.

    Giuseppe De Fazio
    [AizoOnPaesi4]

    Via San Vincenzo 2 |16121 GENOVA
    www.aizoongroup.comhttp://www.aizoongroup.com/ | www.aizoon.ithttp://www.aizoon.it/
    AUSTRALIA Sydney NSW
    EUROPE Bari Bologna Cuneo Genova Milano Roma Torino ITA | Sheffield UK
    USA Cambridge MA | Lewiston ME | New York NY | Troy MI

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2023-02-17

    Are you sure the first part is correct? Select from seems to be SQL instead of OQL?

     
  • Giuseppe De Fazio

    yes, it works, try with a simple query; you can write in this way if you need to select the second class used in the join.

    Giuseppe.

     
  • Giuseppe De Fazio

    Solved! You have to join the link class before, so you can avoid the field class because the link class had the value field. This is the correct OQL query:

    SELECT U FROM TemplateFieldValueLnk AS V
    JOIN Organization AS U ON V.field_target_key=U.id
      WHERE V.field_code='Divisione' 
       AND V.obj_key = 239

    sorry to bother you and thanks for your help.
    Giuseppe.

     

    Last edit: Giuseppe De Fazio 2023-02-17

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.