Menu

customized request form OQL issue: field 1 select "myci" field 2 select "myci" but not the exclude the one selected in field 1

benlisle
2022-01-10
2022-01-12
  • benlisle

    benlisle - 2022-01-10

    Hello there,

    I m meeting an issue with an OQL querry
    here is the context:

    using : customized request form plugin

    creating a request model

    There is a first field named "field1" for the example.
    It s a dropdown list, and I want the user to select only a specific ci "myci"
    which lead to :

    "SELECT myci"

    Now, i have another field, name "field2", is a dropdown list, i want it to also list "myci" but without the one selected in the previous field : field1.

    "SELECT myci WHERE myci.name NOT LIKE :template->field1"
    or
    SELECT myci WHERE myci NOT LIKE :template->mod1

    but it's not working. I ve tested many other things and i currently don't have a working solution, explaining why i'm calling for your wisdom and intelligence.

    Thank you in advance and best regards.

     
  • Vincent @ Combodo

    Have you tried this:
    SELECT myci WHERE myci.name NOT LIKE ":template->field1"

     
  • benlisle

    benlisle - 2022-01-10

    same as :
    SELECT myci WHERE myci.name NOT LIKE":template->field1" lead to the same result

    it s not excluding the value selected in field1.

    I see several options explaining that:
    1)
    maybe it s due to the initialisation of the list not refreshing (but then there would be other problems) -low probability
    2)
    wrong syntax
    3)
    not possible with OQL
    4)
    problem around myci.name vs some myci
    would it be possible to do the query only on myci or to write :template->field1.name if the fields are comparable.

    Thank you for your answer , and others answers in advance.

    Best regards

     
  • Vincent @ Combodo

    I was able to make it work with
    SELECT Contact WHERE name LIKE :template->type
    But the field type was a text in which I entered "Ch%"
    I was not able to combine the field and a % within the query, that is probably not possible

     
  • benlisle

    benlisle - 2022-01-11

    Hi,

    thank you again for your answer.

    I tried your solution and it's not working for me (adapting Contact & type). Moreover it's not a wanted one since the objective is to restrict user input (with a dropdown list from which some choices already selected are excluded).

     
  • benlisle

    benlisle - 2022-01-12

    Here again on the subjet quickly !
    lets see the following:
    field1:
    SELECT myci
    field2:
    SELECT mycibis where myci= :template->field1
    field3:
    SELECT myci WHERE myci.name= :template->field1
    field4:
    SELECT myci WHERE myci.name = mystring

    field 1 , 2 and 4 are working as intended. Meaning in field 3 , the issue is with template->field1.

    In the documentation:

    https://www.itophub.io/wiki/page?id=extensions%3Arequest-templates

    the only indication is:
    The OQL can have a parameter in the form :template->code, where code is the code of another field.

    After a few test, :template->field1 is the id of the CI. problem solved for me then. Thank you again.

     

    Last edit: benlisle 2022-01-12

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.