Display Specific Font Awesome Icon Based on Database

Hey all,

I have a repeated table. In one of my columns there is a notice:
Did your budget request get approved?
In the database the “BudgReq_ApprovedOrNot” data is stored as an integer and the values mean this:
0 == not approved
1 == approved
3 == unanswered

I’d like to display a Font Awesome Icon based on each of those. But, how can I get Wappler to say:
If BudgReq_ApprovedOrNot == 0
then show “fas fa-thumbs-down”

If BudgReq_ApprovedOrNot == 1
then show “fas fa-thumbs-up”

If BudgReq_ApprovedOrNot == 3
then show fas fa-question

There is a dynamic attribute for class you can use on the icon. Just set one for each state you want to use

1 Like

Add all 3 icons to the column and include a dmx-show="_eval" condition to each one where the _eval is one of your conditions above respectively.

E.g.

dmx-show="(BudgReq_ApprovedOrNot == 0)"

1 Like

Oh, wow, I did not realize that the Font Awesome had it’s own dynamic show! Thanks!!!

If I want to colorize those based on those values, how do I do it?

Wait - i see I can add dynamic styling, I bet it’ll work.

Thank you!!

Yes, same thing for styling. There’s various dynamic attributes

1 Like

You can also add dynamic classes as bpj mentioned so with bootstrap you can just use the colour classes:

When the condition is met the class is added, when not met the class won’t be added.

1 Like

Now, this is a similar question… it’s part of the same table.

I also list a budget category.
In this “Budget Request” table the category of budget is defined by a number.

It is BudgReq_Budget.

In another Table I connect all the numbers to names.
i.e.
1 = Salary
2 = Savings
3 = Marketing
4 = Admin
etc.

This budget request is returning the number of BudgReq_Budget. If I’m in the repeated region, how can I connect to list the name of the budget from the other table instead of the number?

I can’t figure that out in Wappler.

Can’t you just do a join on the tables in the server action?

1 Like

You do that in the database query - join the table there so it’s available in each row of the output already. You COULD do it on the client but makes little sense to do so.

1 Like

Thanks, I think my brain was tired. A join was it.
Thanks!