Forum Discussion
Hi Pakema
Before attempting to go any further with this one, let's see if I understand what you are trying to do.
You have three variables and you need to check if they all contain a value other than "" or null. Is this correct?
If so, ideally what you want is a single routine that passes these variables to a function, which will test for any of them being "" or null. If any of them are equal to "" or null, then this function returns a boolean false, otherwise, it returns a boolean true. Or, alternatively, it returns a message stating that they all contain values or specifies which ones are "" or null.
Is this what you need?
Regards
Stephen.
Hi sbkeenan
You're absolutely right
- sbkeenan10 years agoFrequent Contributor
Hi Pakema
OK! Now that I understand what you are trying to do, how does this look:
sub F5 dim i dim a, b, c dim myArray 'all no a no b no c no b&c no a&c no a&b myArray = array(1,2,3 ,,2,3 ,1,,3 ,1,2, ,1,,, ,2,, ,,3) for i = 0 to ubound(myArray) step 3 a = myArray(i) if i + 1 <= ubound(myArray) then b = myArray(i + 1) else b = null end if if i + 2 <= ubound(myArray) then c = myArray(i + 2) else c = null end if if (F4(a, b, c)) = true then log.Message("All values are present") end if next end sub function F4(a, b, c) dim result result = true if varType(a) = 10 or isNull(a) then log.message("A has no value.") result = false end if if varType(b) = 10 or isNull(b) then log.message("B has no value.") result = false end if if varType(c) = 10 or isNull(c) then log.message("C has no value.") result = false end if F4 = result end functionI must admit I had some difficulty in determining whether an array index is blank, but essentially what this does is reads 3 elements at a time from the array and passed them to the F4 function. Thsi determines whether any of them is missing and reports on that. It also returns a true or false value to the calling routine depending on whether all the elements were present or not.
Hope this helps!!
Regards
Stephen.