Sam P Posted September 25, 2023 Share Posted September 25, 2023 I have brought together a Widget to display our high priority requests in a datalist but wondered if there is a way I can specify column width? Summary seems to be preset very wide and is taking a lot of space that could nicely be used to prevent the word wrap on some of the other fields. Thank you Link to comment Share on other sites More sharing options...
samwoo Posted September 25, 2023 Share Posted September 25, 2023 Hi @Sam P, I'm not sure if this will help at all, but thought it was worth mentioning.... I've had this issue, though in your screenshot, I cannot tell if you have other request details further below the screenshot, where the the length of Summary is as long as the arrows you've drawn on the screenshot, but my workaround was to shorten the summary within the SQL. CASE WHEN LENGTH(h_summary) > 140 THEN CONCAT(LEFT(h_summary,140),'...') ELSE h_summary END Summary If the length of the summary is 140 or more, just display the first 140 characters, then append the 3 dots to the end "..." to indicate it's been truncated, otherwise display the summary as normal. You can change the number 140 to something small if required, to truncate it further. Link to comment Share on other sites More sharing options...
Sam P Posted September 25, 2023 Author Share Posted September 25, 2023 @samwoo thanks I'll give this a go. We typically restrict summary to 50 characters so fingers crossed! 1 Link to comment Share on other sites More sharing options...
Sam P Posted September 26, 2023 Author Share Posted September 26, 2023 @samwoo sorry to ask...where in here do I put the text you have shared above? I have no SQL skills and only brought this together by copying someone else on here. Any help appreciated, thanks Link to comment Share on other sites More sharing options...
samwoo Posted September 26, 2023 Share Posted September 26, 2023 Hi @Sam P, No worries at all, here is the amended SQL at the bottom. I did make a tweak to how the Status is displayed, personally, having a CASE statement is easier on the eyes and on the processing of the SQL on the system. Embedding multiple REPLACE functions does take up more processing power as it would have to go through each function. A CASE statement works similarly to how and IF statement works in many other languages, and only evaluates on the matching value, using less processing power. IF (<CONDITION 1>) THEN VALUE ELSE IF (<CONDITION 2>) THEN VALUE 2 ELSE OTHER VALUE END IF In my own testing to make sure I could get this working, I changed h_fk_priorityname to do a wildcard % search ( h_fk_priorityname like 'P2%' ) but you might prefer to be more specific as per your screenshot ( h_fk_priorityname = 'P2 - High (2 Days)' ). It's a matter of preference. Here is the amended SQL: select h_source_type as Source, h_pk_reference as Reference, h_datelogged as "Date Logged", CASE h_status WHEN 'status.new' then 'New' WHEN 'status.open' then 'Open' WHEN 'status.onHold' then 'On Hold' WHEN 'status.resolved' then 'Resolved' WHEN 'status.closed' then 'Closed' WHEN 'status.cancelled' then 'Cancelled' END as Status, CASE WHEN LENGTH(h_summary) > 50 THEN CONCAT(LEFT(h_summary,50),'...') ELSE h_summary END as Summary, h_fk_priorityname as Priority, h_fk_team_name as Team from h_itsm_requests where h_status IN ('status.new', 'status.onhold', 'status.open') and h_requestType = 'Incident' and h_fk_priorityname like 'P2%' ORDER BY h_datelogged DESC The code block on the forums doesn't appear to match the source formatting very well in case you are wondering why some of the code is out of alignment. II hope this helps Thanks, Samuel 1 1 Link to comment Share on other sites More sharing options...
Sam P Posted September 26, 2023 Author Share Posted September 26, 2023 @samwoo Wow amazing! Thank you this has worked perfectly and am grateful for your explanations too as it helps me understand it better and tweak others if needed. Thanks again Link to comment Share on other sites More sharing options...
samwoo Posted September 26, 2023 Share Posted September 26, 2023 No problem at all @Sam P - I'm pleased to hear that it has worked for you 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now