Hi, I am learning java and i am stuck at point where i don't know what i am doing wrong. I am trying to get a field that is being populated as True/False from the system to change to Yes/No. I know that i have to put an if/else statement but the problem is I don't know the correct approach to execute this.

This is the code:

strBuff.append("<td   class=\"LABEL\">" + MaterialType.getAttribute("defaultSupplierForMaterial").getAttDisplay() + ":</td><td   class=\"FORMELEMENT\">");
                            if(dataHeaderFlexObject.getString("LCSMATERIALSUPPLIER."+MaterialType.getAttribute("defaultSupplierForMaterial").getColumnPrefix()+MaterialType.getAttribute("defaultSupplierForMaterial").getAttColumn())!=null){
                                strBuff.append(dataHeaderFlexObject.getString("LCSMATERIALSUPPLIER."+MaterialType.getAttribute("defaultSupplierForMaterial").getColumnPrefix()+MaterialType.getAttribute("defaultSupplierForMaterial").getAttColumn()));
                            }
                            strBuff.append("</td>");

True and false is set to the "defaultSupplierForMaterial" and i want to to display yes and no.

Any help out there?

Thanks

The logical choice would be to use the ternary operator here (check your language tutorial to find out what it is and how to use it).

You should also really consider cleaning up your program, it is terrible to read making it hard to understand and maintain.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.