In reply to: Paweł Tołoczko
Thank you guys but I think I will start from beginning - I have a bad day today and I'm having trouble connecting the "dots".
From begining:
1. Item list (mix names form other flow not connected with any source so ID befor # is random) >> _Wszyscy Audytorzy
2. This Item list (_wszyscy audytorzy) is used in another Item list "Harmonogram Audytu / Kontroli" in field "Odpowiedzialny".
after filing full item list I would like to move to next step the "parent element" and start for each row new work flow.
3. Each sub work flow I would like to assigne to all people in cell row/column >> but:
if non of people: 123123#janek;123123223#bonifacy;12312#john is not a BPS user then assign to person from field "_Audytor Wiodący" (tech field) or whatever
if 1 or 2 or all people are BPS users then assign subwork flow to them,
at the moment I can start subworkflow (no sql - sorry I don't understand how to config the source tab to have proper data so ... I skipped that to "normal" "start subflow"
I understand I can do subflow with out for each but .. I can't config it in proper way....
So I did that:
I do for each row
inside i do just for check condition with sql >> but it returns all time false :| - probably by this random stuff before name ..any way is not working :|
i try to do this (chatGPT):
[code]
IF EXISTS (
SELECT
COS_BpsID,
COS_Login,
COS_IsActive,
COS_AD_name,
COS_AD_mail,
COS_AD_userprincipalname
FROM
CacheOrganizationStructure
WHERE
COS_AD_name IN (
SELECT
-- Wyodrębnij część tekstową po znaku '#'
SUBSTRING(item, CHARINDEX('#', item) + 1, LEN(item))
FROM
dbo.SplitToTable('{SN:936}', ';')
)
)
BEGIN
SELECT 1;
END
ELSE
BEGIN
SELECT 0;
END
[/code]
still c**p ... :|
I was even thing maybe other solution like >> in each row add more tech column and by form rule check if names used in "odpowiedzialny" is in bps users ... if yes then put in some techfield1 and in tech2 field put "true"
and if non then empty tech1 and "false" in tech2 and then do in automation to grab false value and easy sub flow and if true then grab field to who assign ... in theory sound easy ... but constract buisnes rule / rule in cell Odpowiedialny ... not realy easy ... :|
in [system] start path I fill other Itemlists in subflow ...
I guess ..if I could manage assigments then should be easy to do similar way to create Tech item list in sub flow with 2.2.2 i row 1 and 2.2.3 in row 2 and do automation for each row to fill Item list with questions .. but this is not the main issue ....
Probably is easy way to solve my problem but i don't see it ..
To check if user is in a certain source/table you can do inner join by login, BPSid, etc., or left join with null filter. But SQL you have beedn already given is all you need.
You can add two actions of assignin task and run them on condition that there are BPS users or not. For example, Action 1 - if exists BPS user = True >> run action and assign to BPS user, Action 2 - if exists BPS user = False >> run this action and assign to non BPS user.
All you need is to take all the data from your list and put it in "run subflow" action. Thats it. You don't need to add any tech columns etc. because it is unnecessary data, but if it is easier for you to put checking rule in that way, you can do that. However, it won't give you much, since you still need to filter who is BPS user and who is not.
Still, I do not mind why you are trying to use "for each row" operator? Run sublows by dedicated actions firstly, with all necessary data, and then check your users and assign tasks within subflows.