Philipp Mayer

    Philipp Mayer

    3 years ago
    Hey guys, I'm quite new to exposed and pretty sure I'm missing something:
    override fun getColorByCompany(company: String): List<String> {
            val color = transaction { Companies
                    .slice(Companies.color)
                    .select { Companies.name eq company }
                    .map { it.toString() }
            }
           return color
        }
    How can I get a single string as result and not a list of strings? Or should I convert it afterwards for myself? Thanks in advance!
    e

    Evan R.

    3 years ago
    I generally use
    .firstOrNull()
    here. That way you’ll get a string if it exists or null if no results were returned.
    Philipp Mayer

    Philipp Mayer

    3 years ago
    That solved it. Thanks!