Hello,
I am struggling to wrap my head around a problem I am having with one of the sections of my survey.
For background, this part of the survey will be used to record dynamic cone penetrometer (dcp) blows per 50mm. Currently, the user can enter how many blows it took them to go down each 50mm increment. That is fine, and very simple however sometimes a single blow might go down multiple 50mm increments for example 250mm in one blow. If it does indeed take 1 blow to go down 250mm then the user would need to enter '0.2' in each of the fields.
In this case, what I am trying to do is allow the user to go to the depth that the dcp has dropped to, and enter '1'. I then want the survey to check to see if the 50mm increment before it has any data in it, if it doesn't then it will note that (assigning it a value of 1 in the background), it will then check the increment before that and so on so forth until it comes to an increment that has a value entered into it, at which point it will 'stop' (or assign it a value of 0). The survey will then divide the initial '1' (that we entered at the 250mm mark) by 1 (for the initial one) + the sum of all the other 1's (made up of previous fields who's string-length = 0) . It will then override the '1' we entered in the 250mm field and assign it the last of the '0.2's' that are now entered in the previous values.
It is important to note that '0' should not be considered an empty field, as it is possible to have 0 blows per 50mm if the dcp sinks under its own weight.
For every increment, except the first value some form of this logic will need to happen, checking back through each increment until a non empty string is encountered. Just struggling to figure out exactly how to go about this.
Any help would be much appreciated.
I have attached a photo of this part of the survey.
Cheers
Just some more clarification, the calculation will only need to be executed if the value of '1' is entered into a field. if '2' is entered then we don't need to check if previous increments are empty. I'm not sure how to approach this because it's sort of back-calculating fields so do you approach it from the angle of 'if I enter '1' here then do this calc on all previous fields', or do you approach it from the angle of 'if this field is empty, determine its value based on a later value being '1'.
so far I have managed to achieve this for the first 150mm however the process i have written is extremely time consuming, considering i have to go down 5 meters.
This is what i have so far, which enables the outputs shown in the attached images:
_0_50_blows | |
_0_50_recorded | if(string-length(${blows_0_50}) = 0 and ${blows_50_100} = 1, round((1 div 2),2), if(string-length(${blows_0_50}) = 0 and string-length(${blows_50_100}) = 0 and ${blows_100_150} = 1, round((1 div 3),2), ${blows_0_50})) |
_50_100_blows | |
_50_100_recorded | if(string-length(${blows_50_100}) = 0 and string-length(${blows_0_50}) = 0 and ${blows_100_150} = 1, round((1 div 3),2), if(string-length(${blows_50_100}) = 0 and string-length(${blows_0_50}) > 0 and ${blows_100_150} = 1, round((1 div 2),2), if(${blows_50_100} = 1 and ${_0_50_recorded} < 1 and string-length(${blows_0_50}) = 0, ${_0_50_recorded}, ${blows_50_100}))) |
_100_150_blows | |
_100_150_recorded | if(${blows_100_150} = 1 and ${_50_100_recorded} < 1 and string-length(${blows_50_100}) = 0 and string-length(${blows_0_50}) = 0, ${_50_100_recorded}, if(${blows_100_150} = 1 and ${_50_100_recorded} < 1 and string-length(${blows_50_100}) = 0 and string-length(${blows_0_50}) > 0, round((1 div 2),2), ${blows_100_150})) |
Anyone know a way to drastically improve the efficiency of this to check through each increment all the way down to 5m?
This works, but as you can see is extremely laborious to be able to go down 100 increments.