cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Cascading lookup validation control

Hey!

I have a request Control in a workflow, that has 3 linked lookups. They are cascading lookups, i.e. the details are in a list and only show items relating to the previous lookup.

I want to have a validation rule on the lookups, the first 2 are easy as they always have values, but the 3rd lookup doesn't always have a value. is there a expression I can put in the rule that counts the number of items in the lookup?

The Named Control is called rootCauseSubCategory. I have put count n there, but I know it doesn't work as it counts the number of a repeated section.

RootCauseSubCategory=="" && count(RootCauseSubCategory)>0

Is there another function that will return the number of items in a lookup, so I can use a validation rule on the control?

Thanks!

Labels: (2)
0 Kudos
Reply
6 Replies
Workflow Hero

Re: Cascading lookup validation control

Hi Dan,

I think your validation has to be processed via JavaScript where you should be able to count the items of the last dropdown and if it has items make it invalid if none was selected.

If only I would be good in JavaScript :/

Kind regards,

Enrico

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Cascading lookup validation control

there is no direct way how you could determine number of items in a lookup control.

but you can achieve that with a little trick using calculated value control.

set up calculated value control so that it looks up the same list as 3rd-level lookup control (L3_lookup in my example below) and let it filter by the same 2nd-level control as you filter 3rd-level lookup control (L2_lookup).

output of lookup function will be array of just the same items you get in 3rd-level lookup.

if you then calculate length of that array you will get number of items in 3rd-level lookup control

length(lookup('L3_lookup','lkp',L2_lookup,'Title',true))‍‍‍

Accept as Solution Reply
Workflow Hero

Re: Cascading lookup validation control

Hi ‌, were you able to resolve this?

if could you close the thread and select correct answer?

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Cascading lookup validation control

Hi Marian,

I am having the same kind of issue. below is the screen shot of my question:

Could you please help me to hide that lookup field (Corporatecard) when the drop down shows no value:

I have tried your formula mentioned here, but my calculated field shows 0 value, not sure why.

I got a requirement to create a Sign Up form for the Visa Corporate cards, we have total 3 corporate cards. 

once the card is booked no other user can book the same card.

For this requirement I have created 2 SharePoint list.

1st list called cards.  I have created the below mentioned fields,  cardsavailable and available are calculated fields.

2nd list is a actual sign up sheet called visa corporate. here I have added a lookup field that comes from the 1st list(cards)

Then I built a nintex form on the sign up sheet and added a lookup field with the below mentioned filter condition, when the card is available on the 1st list then only it will appear on the sign up sheet, otherwise not shown up in the dropdown field of the lookup field.

 

What I want, if the all cards are booked on the 1st list, then what formula can I use to hide the lookup field in the sign up sheet? Note: when all cards are booked on the 1st list then drop down field shows no values (cards). #

I am using this formula to calculate value in dropdown field.

Any help is much appreciated.

Thanks. 

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Cascading lookup validation control

I'd say your formula should look like

length(lookup('Cardremaining','available','yes','ID',true))<= 0
Accept as Solution Reply
Workflow Hero

Re: Cascading lookup validation control

I have tried this formula, it is working perfectly fine. Thank you so much for your help.

Accept as Solution Reply