Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By mohamad
#824362
Dear Experts,
I want to query from my dynaform at the dorpdown property to get the member groups. I used the codes below in sql part of dropdown:
<membersGroup type="dropdown" required="0" readonly="0" mode="edit" btn_cancel="Cancel">
<![CDATA[SELECT U.USR_UID, U.USR_USERNAME from (USERS U left join GROUP_USER GU on U.USR_UID=GU.USR_UID) left join CONTENT C on
GU.GRP_UID=C.CON_ID where C.CON_VALUE='my group']]>
<en>Members of a particular Group</en>
</membersGroup>

Unfortunately, nothing appears in dropdown.
I was wondering if you could help me to solve it.
Kind Regards
User avatar
By amosbatto
#824363
The SQL query is correct, but you are using XML code from a classic process. That XML will only work in version 2.X or if you have imported a classic process from version 2.X into version 3.X. Also remember that the group name is case sensitive.

If you are using a BPMN process in version 3.X, then here is an example that you can use:
(1.25 KiB) Downloaded 21 times
By mohamad
#824378
Thank you very much,
I use the code below and it works for me, however, I do not know why are there the repetitive names . I mean, in my database, there are 2 repetitions for each name!!! In example, there are 2 (105) and 2 (101).
My code is correct, because I checked phpmyadmin, and this situation was in that table!

SELECT U.USR_UID, U.USR_USERNAME FROM (USERS U LEFT JOIN GROUP_USER GU
ON U.USR_UID=GU.USR_UID) LEFT JOIN CONTENT C
ON GU.GRP_UID=C.CON_ID WHERE C.CON_VALUE='my group'
How can I remove the repetitive names? Would you please help me?
Kind Regards
Attachments
query.jpg
query.jpg (29.96 KiB) Viewed 1354 times
User avatar
By amosbatto
#824388
What version of PM are you using?
In some versions of PM, the classic Dynaform designer executes its JavaScript twice displayed inside the designer, but this doesn't happen when running a case. Have you tried it when running a case?
By mohamad
#824392
Dear Amosbatto,
I am using PM 3.3.4 (windows).
My code was not javascript, I used SQL. As I mentioned, this problem is in my database, too. The names are repetitive, and each name is emerged 2 times. If you check my image which is attached with this post, you can see my problem. In database's table, there are 2 USR_USERNAME and 2 USR_UID.
Yes, when I run a case, this problem is available, too.
Of course, I'll try my code in another version of PM.
Kind Regards
Attachments
query.jpg
query.jpg (78.25 KiB) Viewed 1340 times
User avatar
By amosbatto
#824402
Try this query:
SELECT DISTINCT U.USR_UID, U.USR_USERNAME FROM (USERS U LEFT JOIN GROUP_USER GU
ON U.USR_UID=GU.USR_UID) LEFT JOIN CONTENT C
ON GU.GRP_UID=C.CON_ID WHERE C.CON_VALUE='my group' AND C.CON_CATEGORY='GRP_TITLE'
GROUP BY U.USR_UID

Does that fix it?

Hi, Is there any way to show my custom column only[…]

Send for clarification

Hi, I know this is an old post but i could not fin[…]

add dropdown to search process

Please replay if there is any solution!!!!

Amosbatto, PMUsers.com is down.

Hi Amos, I appreciate you setting up a tips and t[…]