You are viewing limited content. For full access, please sign in.

Question

Question

Forms Error "invalid number of arguments"

asked on November 8, 2018 Show version history

I recently made a change on a form that is now resulting in this error message upon submit:

The function 'LEN' was given an invalid number of arguments.

 

This form has been working perfecting for a number of years.  The applicant needs to add a long-legal address OR a rural address.  Occasionally, the applicant will enter too many digits in the first part of the long-legal address and then the form will not save to Laserfiche because of a constraint on the field.  

I recently changed the first part of the long-legal address (a collection field) to be a drop-down pick list instead of free-form, to force the applicant to only pick valid formats.  This is working perfectly.

The problem that we discovered today is that the form now is confused if the applicant only fills in the rural address and does not attempt a long-legal address.  I have double checked to make sure I didn't turn on the Required option.  I did not.  And yet, this error is coming up only when the applicant leaves the legal address options blank.

I did see on another post that someone who got this error resolved it when he discovered that the changed piece did not have a variable name, however, mine does have a variable name.

Causes?

0 0

Answer

SELECTED ANSWER
replied on November 14, 2018

For anyone else researching this, this is the post where I found the answer:

https://answers.laserfiche.com/questions/141909/LFF0337-error#142635

and this is the link to the Laserfiche Forms 10.3.1 Update 1:

https://support.laserfiche.com/kb/1013963/list-of-changes-for-laserfiche-forms-10-3-1-update-1

0 0

Replies

replied on November 9, 2018

Hi Connie,

Can you share the formula where the 'LEN' is being used? 

Have you recently upgraded to a new version of Forms?

Thanks!

0 0
replied on November 9, 2018

Have not recently upgraded.  We have been running on 10.3 at least six months, maybe nine (can't remember when it was released, but shortly after that).

The formula:

=IF(OR(LEN(INDEX(Legal_Address.Quarter,ROW()))=0,LEN(INDEX(Legal_Address.Section,ROW()))=0,LEN(INDEX(Legal_Address.Township,ROW()))=0,LEN(INDEX(Legal_Address.Range,ROW()))=0),"",CONCATENATE(INDEX(Legal_Address.Quarter,ROW()),"-",RIGHT(CONCATENATE("000",INDEX(Legal_Address.Section,ROW())),2),"-",RIGHT(CONCATENATE("000",INDEX(Legal_Address.Township,ROW())),3),"-",RIGHT(CONCATENATE("000",INDEX(Legal_Address.Range,ROW())),2),"-W4"))

The "Burn Site" is a collection of the four fields above it.  

and looks like this upon execution:

0 0
replied on November 9, 2018 Show version history

First I would confirm that both of your drop-down files have values in them. Could it be a blank row that accidentally gets selected and the null value is throwing off the formula? If so, you could nest another IF formula to make sure the value is not "". example:  IF(var="", "", var) 

Another thing to test are the values being sent to the formula. I would have the console list the value for each of the fields with a consol.log() on the javaScript tab. Then you could see exactly what is being sent to the formula.

Good luck!

 

0 0
replied on November 9, 2018

Thanks, Chris.

1) Could it be that changing the first field to a drop down list makes the system recognize that there is actually a value in there and now it's thinking, "Okay now lets finish this, you haven't completed all the pieces yet."?  If so, is there a way to make it stop insisting?

2) I'm not sure how to run that test that you are talking about.  The console?  What would I put in the JavaScript... exactly?

0 0
replied on November 9, 2018 Show version history

Hi,

1) That was kinda what I was thinking. Maybe have every value tested to make sure it isn't null. Something like:

IF(OR(val1, val2, val3)="", "", *run your original formula*)

2) When you right click and inspect an element, you can view the html/java for the page. There is a tab for the console or it will just automatically appear depending on what browser you are using. I use Chrome Canaray (developer version) and it looks like this:

Anyhow, if you put some javaScript to show the values, that is where they will appear. The code would look something like:

console.log(
$('.element1Class input').val() +", "+
$('.element2Class input').val() +", "+
$('.element3Class input').val() 
);

^that will show in the console log the values for the fields "element1Val, element2Val, element3Val"

Of course you can select the field with a class (.something) or an ID (#q123). 

 

0 0
replied on November 9, 2018

My console on that field is blank.  Should there be something there?

Is there a way to tell it to consider this field blank until someone actually picks something (which is what I assumed it would do).

0 0
replied on November 9, 2018

I'm sorry, my knowledge of javascript is very minor.  I have taken some pieces that people have given me here at LF Answers and used them successfully and have been very grateful, but I am having trouble seeing what to do here.

I have been trying to compare your code to see how it relates to mine and haven't figured out what I would change on mine to make it do what you are suggesting.

0 0
replied on November 9, 2018

Hi Connie,

Nothing will appear in the console until you put your code in your 'CSS and JavaScript' tab of the form. You have to tell it to show the values. 

Did the part about the formula make sense?

 

0 0
replied on November 9, 2018

Chris, the formula.  Not really, in that I'm not sure what to adjust to make it work for me.  I keep thinking I need to have 4 instead of three and change your element numbers to the field ID's...  ?  Like this:

console.log(
$('.element#q36Class input').val() +", "
$('.element#q37Class input').val() +", "
$('.element#q38Class input').val() +", "
$('.element#q39Class input').val() 
);
0 0
replied on November 9, 2018

So I tried it in a test copy of the form and then got this under the console tab:

0 0
replied on November 9, 2018 Show version history

Oh yeah those are just examples, not a literal. Swap out ".element#q39Class" with whatever your element is. If "#q39" is the ID for your element then it would look like:

$('#q39 input').val()

You can see what the ID is on the CSS an JavaScript tab or by inspecting the element in the browser.

Since you have the 4 fields I will just guess that q36 - q39 are those fields:

console.log(
$('#q36 input').val() +", "+
$('#q37 input').val() +", "+
$('#q38 input').val() +", "+
$('#q39 input').val()
);

If those aren't your IDs then just modify it to include your IDs.

What you should see in your console is something like (from your picture above):

SW, 10, 40, 12

The whole purpose here is to see what is being sent to the formula. That will tell you if the problem lies with the formula or not. Not a resolution to the problem, but hopefully a clue.

0 0
replied on November 9, 2018 Show version history

Okay, thanks!  Now I'm getting:

0 0
replied on November 9, 2018

Chris, if you look at my first response to you today... that last piece that I provided which has an orange background, you can see that the variables were all collected okay in that test run.  The greyed out field, which is a read-only field that collects the four pieces that were entered.  Is that not the answer you were looking for but attempting via javascript?

0 0
replied on November 13, 2018 Show version history

Not really, because you could have a value assigned to the drop down choice "SW" that is not "SW". For example:

I was suggesting to confirm your values are what you think they are. 

Another way to see what values are used is to check the Variables list in the Monitoring Tab:

You can see all your values being used in the formula there. 

 

0 0
replied on November 14, 2018

Thanks, Chris.  Yes, the Variables tab when monitoring the instances is a way that I sometimes check what was actually in the fields upon submission.

So, an update:  In further research, on Friday I did discover another post that someone had indicated that there was a PATCH to fix this.  Our IT applied that patch yesterday and it appears that I no longer have this problem.

So, all is well now.  Thanks, Chris!

1 0
SELECTED ANSWER
replied on November 14, 2018

For anyone else researching this, this is the post where I found the answer:

https://answers.laserfiche.com/questions/141909/LFF0337-error#142635

and this is the link to the Laserfiche Forms 10.3.1 Update 1:

https://support.laserfiche.com/kb/1013963/list-of-changes-for-laserfiche-forms-10-3-1-update-1

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.