How can one set a default value for an integer without showing it for everyone7

I want to set default value for integer say ‘0’ zero. if a respondent refuses to give an answer it will default to zero,but if answered the enumerator can then fill in the data or value.

Am adding values in figures

I dont want my end result to show null values in powerquery.

Thank you

Hello @chiabotu,
why not solve this

  • in Power Query?
  • a hint to the enumerator (and explanation in training) and setting the field to required?

You canNOT easily implement your demand with KoBo/XLSForm because

  • you could only preset a value per default or per once(…) calculation, but this can be overwritten by the enumerator
  • and a normal post-entry calculation canNOT use/reference the current value as reset value, like calculation:
    if( . = ‘’, 0, . ) – or – coalesce( . , 0 ).

But we found a workaround, using trigger, default and coalesce, see example here
RefSelf01.xlsx (10.8 KB). The variable should not be set to required (true) here, as msg will have an update problem.

Another workaround could be to create an additional (invisible) calculate type variable which is set with calculation: coalesce(${OrigVar}, 0) – or an if(…) clause.

Generally, I would try to avoid influence of an analysis tool on your form design.

1 Like

I have a set of data that involves skip logic.
Responses from the questions where uploaded into powerquery.
The results been that i now have repeated rows of data for every single unique id.
I found it difficult to collapse those multiple rows of data into so that they can match every id no assign to them and the new unanswered question which is generated as null to replace entry or update entry before it


This data coming into powerquery are dataset from the web.
Each entry can as well update entry preceding it using sort by date method in descending.

Now the issues is that there are nulls for every rows…including rows containing my data.

I have worked on this for several hours to get around why nulls values as result of nulls coming from kobo calculations when i
Added say ${Biology}+${Agric} =Answer, buh when no entry on ${Agric} it results into nulls.
I want a suituation where if nulls return 0.

I have struggle to update nulls for nulls in powerquery it wont let me. WHY? because the solutions to my challenge requires using unpivot columns that remove nulls. Somehow, i what to keep the nulls values created by kobo which could be an unanswered question or entry.I have even change nulls to zero to no avail.

Please,how could it be achieve in kobo to default unanswered field to zero. So that i can make use of the zero easily in powerquery

Thank you all

Hello @chiabotu,
have you read the help center article how to merge repeats, see ?

Using calculations, you always need to treat empty data, e.g. for integer by using coalesce(…), see …

Also see our (updated) posting above,

Thank @wroos ,however my challenge is not resolved yet.

I want the default zero to be hidden…

@Kal_Lam n others i need help.

I think i was able to resolve this with the help of this work around from the support articles on kobotoolbox.

Just set the validation criteria as for example, if this happen to be your criteria.
You may use a different values for your needs
(. >= 18 and . < 130) or (. = 999)

Response must be between 17 and 130 or be equal to 999. (The code 999 is often used for non-responses.)

I hope this will help someone.

1 Like

@chiabotu, :clap: :heart: :partying_face: