Convert List of Numbers to Text When Exporting to Excel

I have a list of numbers that I get from a yes/no parameter within Revit. I would like to convert this list of 1’s and 0’s to text (1’s = Yes and 0’s = No) so that the text shows up in Excel rather than the 1’s and 0’s. I’ve not found an simple solution on the forum to do this. I’m pretty new to Dynamo so there may be an easy way to do this that I’m missing. Any help is appreciated.

Try this nested if statement. If you don’t want values which are neither 1 or 0 to read a different value then adjust as needed. The not 1 and not 0 values are likely the result of parameters which are not true nor false yet and have not received a value.

paramval == 1? “Yes”: paramval == 0? “No”; “Not Defined”;

Thanks other Jacob for the reply. I’m pretty new to this still. How do I get the statement you created to interact with the other nodes? Or to nest it as you put it? Do I put the statement you created into a code block? Python Script?

You could also utilize the Replace by Condition node and replace by the String Yes or String No if == 1 or 0 respectively.


I’m a code block paste the below (sightly tweaked version of what @JacobSmall has stated, but with more explanation for your future reference) :slightly_smiling_face:

//if this is true
param==1 ?
//then do this
//otherwise if this is true
param==0 ?
//then do this
" No":
//otherwise do this
“Not defined”;

@Ewan_Opie I get an error when I copy your code into a block (see below).

@n_rose this worked like a charm. Wish there was a more straightforward way but this’ll do for now. I appreciate the help.

1 Like

@GBAjake12 Can you try typing it out in the code block?, I have been having copy /paste issues with forum content as of late.:thinking:

The quotation marks are not the right marks :slight_smile: