cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mickow
Helper II
Helper II

Row not to appear if empty

Hi, could you help me with transforming codes I already have? I would need rows on my list (code 1) and in the table (code 2) not to appear if there is nothing chosen in the combo box.  So something like "If Blank, then do not appear". And this should be never applied for the first in table/firs point on the list as it is a must to fill at least one to create a ticket. 2 and 3 are optional. 

 

Attached simple - as is and as it should be 🙂

 

 

 

"<ul>"&
    "<li> "&Concatenate(Concat(xxxCode.SelectedItems,xxx_x0020_Code_x0020_ID,";")," for: ", Concat(Country.SelectedItems,CountryCode,";"))&" </li>"&
    "<li> "&Concatenate(Concat(xxxCode_1.SelectedItems,xxx_x0020_Code_x0020_ID,";")," for: ", Concat(Country_1.SelectedItems,CountryCode,";"))&" </li>"&
    "<li> "&Concatenate(Concat(xxxCode_2.SelectedItems,xxx_x0020_Code_x0020_ID,";")," for: ", Concat(Country_2.SelectedItems,CountryCode,";"))&" </li>"&
"</ul>"&
"<table width='100%' border='1'cellpadding='5' style='border: 1px solid black;border-collapse:collapse'>"& 
"<tr style='background-color:#efefef'>
    <th>Id</th> <th>Job codes</th> <th>Country</th><th>Submitter</th>"&
    "<tr><td> "&1&"</td><td>"&Concatenate(Concat(xxxCode.SelectedItems,xxx_x0020_Code_x0020_ID,";")," </td><td> ", Concat(Country.SelectedItems,CountryCode,";"),"</td><td rowspan=3>", SubmittersName.Text )&" </tr></td>"&
    "<tr><td> "&2&"</td><td> "&Concatenate(Concat(xxxCode_1.SelectedItems,xxx_x0020_Code_x0020_ID,";")," </td><td> ", Concat(Country_1.SelectedItems,CountryCode,";"))&" </tr></td>"&
    "<tr><td> "&3&"</td><td>"&Concatenate(Concat(xxxCode_2.SelectedItems,xxx_x0020_Code_x0020_ID,";"),"</td><td> ", Concat(Country_2.SelectedItems,CountryCode,";"))&" </tr></td>"&
"</table>"& "<br></br>"&

 

 

Is:

list_now.png

 

 

 

 

Should be

list_new.png

 

 

Is

Table_now.png

 

 

 

 

Should be

Table_new.png

 

 

8 REPLIES 8
ganeshsanap
Super User
Super User

@Mickow 

 

Try adding If condition like below for each combo box entry:

 

If(!IsEmpty(xxxCode.SelectedItems.Value), "<li> "&Concatenate(Concat(xxxCode.SelectedItems,xxx_x0020_Code_x0020_ID,";")," for: ", Concat(Country.SelectedItems,CountryCode,";"))&" </li>")

 

Similarly add conditions for other combo box as well as table code.


Please click Accept as solution & 👍 if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it ‌‌👍

Hi @ganeshsanap it does not work. I 'm getting an error that there are some unexpected characters now in the formula.

@Mickow ,

 

"<ul>"&
    "<li> "&Concat(xxxCode.SelectedItems,xxx_x0020_Code_x0020_ID&";")&" for: "& Concat(Country.SelectedItems,CountryCode&";")&" </li>"&
    If(!IsEmpty(xxxCode_1.SelectedItems.Value), "<li> "&Concat(xxxCode_1.SelectedItems,xxx_x0020_Code_x0020_ID&";")&" for: "& Concat(Country_1.SelectedItems,CountryCode&";")&" </li>")&
    If(!IsEmpty(xxxCode_2.SelectedItems.Value), "<li> "&Concat(xxxCode_2.SelectedItems,xxx_x0020_Code_x0020_ID&";")&" for: "& Concat(Country_2.SelectedItems,CountryCode&";")&" </li>")&
"</ul>"

 

@gabibalaban Hey, well this code created like even more errors, 16 to be precise and I think this is because part of the original code (which is working perfectly) was dropped...

@Mickow ,

The idea was to understand the principle. It is hard to transpose here the formula exactly you needed.

There was a misspelling in my formula. Can you try it again ?

Does not work unfortunately. I will try to manipulate with the code later and let you know if I found some solution. 

Mickow
Helper II
Helper II

Hi I think I found a partial solution, but have no idea why it is partial only. Could you help me please? My code looks now as below:

"<ul>"&
    "<li> "&Concatenate(Concat(xxxCode.SelectedItems,xxx_x0020_Code_x0020_ID,";")," for: ", Concat(Country.SelectedItems,CountryCode,";"))&" </li>"&
    If(IsEmpty(xxxCode_1.SelectedItems.xxx_x0020_Code_x0020_ID),"", "<li> "&Concatenate(Concat(xxxCode_1.SelectedItems,xxx_x0020_Code_x0020_ID,";")," for: ", Concat(Country_1.SelectedItems,CountryCode,";"))&" </li>")&
    If(IsEmpty(xxxCode_2.SelectedItems.xxx_x0020_Code_x0020_ID),"", "<li> "&Concatenate(Concat(xxxCode_2.SelectedItems,xxx_x0020_Code_x0020_ID,";")," for: ", Concat(Country_2.SelectedItems,CountryCode,";"))&" </li>")&
"</ul>"&

 And what I've noticed is that it does work for the second line, but not for the third one and the output looks like that:

line_2of3.png

 

I'm guessing that my syntax is incorrect somewhere between the first "If" and ending of the list...

It appears to me that there is no perfect solution and it is not about the code. I can tell that it is some deeper coding issue within PowerApps. I tried both: IsBlank and IsEmpty and both seem to work/not work in certain situations: IsBlank works fine when initially ComboBoxex are empty and there was no action taken on those (even chosen and cleared)...IsEmpty on the other hand works the opposite - it does what it should once something was chosen in the ComboBox and then cleared. This is all weird, but cannot find anything other explaining why it works for me like that. 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (3,391)