cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
AUSharePoint
Nintex Newbie

Need to Verify Multiple Attachments Controls are not Null

Jump to solution

I have 3 attachment controls with one set to default. They each have unique name and a CSS class "attCtrl."

I need to be able to verify that each has been uploaded, or not null. If one is null I need to know which one. 

I thought I could use the name of the control to determine if it was "not empty," but I have not been able to do that.

Does anyone have any advice for this?

0 Kudos
Reply
13 Replies
Automation Master
Automation Master

Re: Need to Verify Multiple Attachments Controls are not Null

Jump to solution

have a look on this my little function https://community.nintex.com/message/42747?commentID=42747#comment-42747 

but,

They each have unique name and a CSS class "attCtrl."

have you configured just the same class name for each of 3 controls?

you will have to give them unique class names, that will as well help you to identify which one breaks the rule.

0 Kudos
Reply
AUSharePoint
Nintex Newbie

Re: Need to Verify Multiple Attachments Controls are not Null

Jump to solution

Thank you for your reply.

I have tried several different ways prior to creating this post, and have been unable to get your function to...well... function

Could you provide a more detailed example? ie. where to put your function and how to call it? 

0 Kudos
Reply
Automation Master
Automation Master

Re: Need to Verify Multiple Attachments Controls are not Null

Jump to solution
0 Kudos
Reply
AUSharePoint
Nintex Newbie

Re: Need to Verify Multiple Attachments Controls are not Null

Jump to solution

thank you yes this does help! I was able to validate a with it.But shouldn't I be able use the number too? 

So I used 

GetNumberOfAttachments('attCtrl')<1

on a attachment control. With no attachment it catches it and displays the error. With an attachement it lets the process finish. So I know it's working. But I am not able to display the number no matter how many attachments the number remains '0.'

I have added 

GetNumberOfAttachments('attCtrl')

to calculated values and form variables but cannot get the number to change. 

Any ideas?

0 Kudos
Reply
Automation Master
Automation Master

Re: Need to Verify Multiple Attachments Controls are not Null

Jump to solution

I'm not sure I understand what are trying to do...

do you want to display current number of files uploaded to a given attachment control, and do you want it to dynamically change once you add or remove one?

if so, then the reason is that this formula doesn't anyhow depend on that specific attachment control, hence it need not to recalculate once attachment control changes.

I wonder whether you really need it, or whether it was meant just as a kind of proof check to see how does it evaluate.

the problem is that attachment control is not listed among named controls, so it can not be directly referenced in calculation formula.

if you really needed to see current number of attached files, it would require some further scripting.

I've never investigated that so I'm not sure how complex it might be.

Reply
AUSharePoint
Nintex Newbie

Re: Need to Verify Multiple Attachments Controls are not Null

Jump to solution

thank you for your response. 

Yes I guess I was trying to see how many were uploaded be for the form was submitted. But I also tried to save the number of attachments by linking it to a field and that did not work either. 

I have 3 attachment controls. They are not visible until after the form has been submitted, and a user returns to the form to upload documents. 

My end goal is to not validate the attachment control being empty until the user returns..... 

Oh wait... so I can use another "yes/no" field to add to the validation, switch it on submit then validate once the user returns! 

Does that make since? I guess I just needed to talk through it.

0 Kudos
Reply
Automation Master
Automation Master

Re: Need to Verify Multiple Attachments Controls are not Null

Jump to solution

I think you do not need any further checkbox.

it looks like you want to apply validation only when user edits existing item, and not apply it when it creates new one.

if so the have a look on 'IsEditMode' common reference.

your formula then might look like

IsEditMode && GetNumberOfAttachments('attCtrl')<1
Reply
AUSharePoint
Nintex Newbie

Re: Need to Verify Multiple Attachments Controls are not Null

Jump to solution

Marian Hatala - Should I be able to use an If() statement in a calculated column to save a "No" or "Yes" based on this script? I'm trying to use this variable in a workflow.

Ex: if(GetNumberOfAttachments('attCtrlAcc')<1,"No","Yes")

0 Kudos
Reply
Automation Master
Automation Master

Re: Need to Verify Multiple Attachments Controls are not Null

Jump to solution

in workflow you can use ItemProperty:Attachments reference to determine whether an item have any attachment. you do not need to save it on your own.

it evaluates to true/false.

0 Kudos
Reply