Dear all,
Can someone help me to change the background color of HTML table td based on certain condition?
If the condition is True the background color of the td should be Green and if the condition is False the background color of the td should be Red?
I have seen a post which is very much similar to my requirement(mentioned below), but I did not get the expected result.
@AshwinS2
can you please rewrite your suggestion by using [grafik] from editor.?
<p class=MsoNormal><span style='background:red;mso-highlight:red'>ABC</span></p>
Please help me with a sample code.
Thanks
Deepak
“p class=MsoNormal span style=‘background:“variable”;mso-highlight:“variable”’ ABCspan></p”
change the red to a variable name and assign red and green via different situation?
maybe need to add & or + before and after the variable
Tried as per your request still there are issues. Attached is the screen shot of the error what i am getting.
aanandsanraj
(Anandraj Rajendran)
September 21, 2021, 5:41am
4
Hi @Deepak_Andriod
Hope below code will give some idea
strTable as string
strTable = "<table>"
if(true) Then
strTable=strTable+"<td style='background:green;'>Success</td>"
else
strTable=strTable+"<td style='background:red;'>Failed</td>"
End if
Thanks but where should I paste this code?
Can I do it on fly?
I just want to change it over here
UserData.Replace(“varService”,varServicePass).ToString
want something like the attached. Attached is from the following link.
can i give this condition in html format
aanandsanraj
(Anandraj Rajendran)
September 21, 2021, 5:58am
8
What are you doing in your requirement?
Check out this Sequence2.xaml (6.5 KB)
I have a HTML Template(saved as a .txt file) and I am passing the value to the .txt file using
UserData.Replace(“varService”,varServicePass).ToString
Using the readtext file I am getting the data in UserData
raymondhui
(Raymond)
September 21, 2021, 6:02am
10
change your color in HTML template to variable, after that, read the HTML template and use .replace to replace it.
aanandsanraj
(Anandraj Rajendran)
September 21, 2021, 6:20am
11
@Deepak_Andriod The idea is keep two different html file for Green and Red background based on the condition pick the right file.
Ok thanks i am going through your code and changing my code accordingly.
I want something like what is shown in the attachement
Got the idea from your code…I will have to change a lot… Let me try and will get back to soon.
aanandsanraj
(Anandraj Rajendran)
September 21, 2021, 9:01am
15
Logic is you have to add the style based on the Column “EmpAttendance” on that td add the background color dynamically like the code I shared.
now there is another issue, if there are 100 rows, how can I do this?
Your logic and the code provided is absolutely working fine.
aanandsanraj
(Anandraj Rajendran)
September 21, 2021, 9:43am
17
Use for each row in datatable activity to loop every row and add the style.
I have another doubt, using UIPath is it possible to transform webservices? Is it possible to convert SOAP to Restful?
system
(system)
Closed
September 25, 2021, 6:10am
19
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.