Oracle APEX changing the colour of display only item with PL/SQL query - html

I have a display only item in a static content which looks like this:
I want to change the whole background colour of the button/item instead of the text's colour.
My PL/SQL code looks like this for example for the first item:
SELECT case ACTUAL_SITUATION when 'Y' then '<span style="color:green">Yes</span>'
when 'N' then '<span style="color:red">No</span>' end as "ACTUAL_SITUATION "
FROM tableName
Is it possible to change it with PL/SQL? All I could do is change the span background colour and that was just a highlight on the text.

Assuming you have a "Display Only" field, set the "Source" to be a "SQL Query(return single value)" and be sure to set under "Security", "Escape special characters" to "No" to allow the HTML to flow through. Note that you want to use background-color not color in your style to set the background.
I tested it and it works.

Related

How to display parts of value from database with different font size in SSRS report?

One of my columns has a value that looks like this -> "$5.95 (Park costs)"
and I need to display the value in column in SSRS report like this:
$5.95
(Park costs)
but font size of "(Park costs)" must be smaller than the price.
Is something like that even possible? To somehow make text that does not contain a number, dot or dollar sign smaller?
You can do this. You'll need to split up each component of the text column and then place each half in a placeholder. You can then format each placeholder individually.
This solution assumes that your column always contains a "(". If not you should be able to modify it to suit.
I Generated some test data and and placed it in a normal table (tablix) control.
I then added some new columns for testing that each part was working as expected.
The expression for "Cost" column is
=TRIM(LEFT(Fields!MyColumn.Value,InStr(Fields!MyColumn.Value, "(") -1))
The expression for the "Caption" column is
=TRIM(RIGHT(Fields!MyColumn.Value, LEN(Fields!MyColumn.Value) - InStr(Fields!MyColumn.Value, "(") + 1))
Once this was working OK I added the "Final Column".
To add a placeholder, click inside the textbox so the cursor appears then right-click and choose "Create Placeholder"
I added two placeholders with a space between then and set the values to the expressions above respectively. I then right clicked the placeholders chose "Placeholder Properties" and formatted each individually.
The final output looks like this. (I left the test columns in for clarity)

SSRS: Is there a Limit to what you can type in a TxtBox Property?

I'm using Visual Studio 2010.
In the Properties for a Text Box in my report I have an Expression like this:
=IIf(Fields!SubCategory.Value = "Value 1:", "Snow", IIF(Fields!SubCategory.Value = "Value 2:", "Snow", IIF(Fields!SubCategory.Value = "Value 3:", "Snow", "White")))
It is working fine but I need to add another IIF clause to include "Value 4:".
The values are not actually "Value 1:" ... etc - but longer descriptive names so the actual text in the Background Colour Property box is longer.
When I try to add the text, I am not able to do so. Is there a reason I cannot add the new IIF clause to the expression?
Sorry. I found out why I was not able to edit the expression in that particular Property field.
I erroneously gave the example of the Background Color property - when I should have pasted the example from the Font Weight property.
The problem was that I had not gone specifically to the 'Font Weight' property but was trying to edit text in the 'Font' category without dropping the arrow and expanding the Font properties.
Once I expanded the Font category, I was able to edit the Font Weight property.
Apologies!

How do I use a CSS attribute's value of an html element as input when submiting a form with Django?

Please first click the link to the image below to understand my question/situation.
If the text below a particular species icon (circle with animal image inside it) is bold, I would like that to be used as input criteria for getting information from a database. In other words, I want to use the font-weight CSS property of a "< p >" element as an input. Only one "species text" can be bold at a time.
For example, if I have "D. rerio" selected (its font is bold) and I click the "search" button, I would like for the back-end to know that it needs to pull information from the "D. rerio" database specifically.
Rather than trying to send the value of the CSS, you should use the same process that sets the CSS to set a value in a hidden field. Something like:
<input type="hidden" name="species" id="id_species">
...
$("#fishIcon").click(function(){
$("#fishIconText").css("font-weight", "700")
$('#id_species').val('fish')
});

Microsoft Report Designer Line Through Text when value not Empty

Has anyone used LineThrough text on Microsoft Report Designer within the expression value?
Example:
=Switch(Fields!a.Value is Nothing, "text here".LineThrough, Not(Fields!a.Value is Nothing), CStr(Fields!a.Value))
I need the "text here" to be strikethrough if a.Value is nothing.
You need to use an expression to show the value you want and then Harry's answer to set the LineThrough.
You can simplify your SWITCH statement for the value like this..
=SWITCH(
Fields!a.Value Is Nothing, "Text Here",
True, Fields!a.Value)
or if the expression will not get any more complex than you have then use IIF
=IIF(Fields!a.Value Is Nothing, "Text Here", Fields!a.Value)
If you need only part of the textbox then the easiest way is to use placeholders. These act almost the same way as a textbox but you can have several placeholders in a single cell/textbox each with it's own properties.
To add a placeholder click the cell/textbox first to get focus then right-click before or after any existing text/placeholders. Select Insert placeholder and set the expression as you wish, you can also format the placeholders font/color/decoration etc.
As an example I've got a small dataset with country names. If the country contains the word "Island" then I show different text and change the text decoration on one of the place holders. In the design you can see there are 3 placeholders, some text then a field then some more text.
When I run this I get the following output.
I've set strike thru on the countrydesc field placeholder but you can do the same on a text placeholder. You still have to do it in two parts, and expression to set the text value and an expression in the placeholders font properties to set LineThrough
You can set the condition on the Font/ TextDecoration on the selected report Item. There is an option for LineThrough.
For Example
=iif(reportitems!Textbox7.Value = "Cartons","LineThrough","Default")

How do I substitute one entry for another an MS Access report?

I recently started working with MS Access 2010, and I am trying to generate labels from a form that I have created. In the form, three pieces of information are put in by the user: style, color code, and unit of measure (UoM). The style numbers appear the same way on the form and in the report, and I have been able to get that to work.
However, for the color code, I need both the inputted color code and the actual color to show up on the report. I have a table that has all of the color codes with the corresponding color names. I cannot figure out how to get the text box that is supposed to show the color name to show it. I know virtually no SQL, but I found information on it on the internet and pieced together this code in the ControlSource for the text box the color name is supposed to be in:
=(SELECT [Description]
FROM [Color]
WHERE([Forms]![Box Label Form]![ThirdJoined]=[Color]![ColorCode]))
[Description] is the name of the column within the [Color] table that gives the actual color name.
[Box Label Form] is the name of the form.
[ThirdJoined] is the name of the input text box within the form.
[ColorCode] is the name of the column within the [Color] table that gives that color code.
This code doesn't work, and only results in #NAME appearing in Print Preview view. How can I get this to work, either code-wise or otherwise?
You cannot set the ControlSource of a textbox to a SQL statement. You could set it to a DLOOKUP function to lookup a single value. You also need to separate out the reference to the form control using concatenation (&).
=DLOOKUP("Description","[Color]","ColorCode='"&[Forms]![Box Label Form]![ThirdJoined]&"'")
I'm assuming the Color is a text-value so the form-value needs to be enclosed in apostrophes.
If this expression is used on the form [Box Label Form] then you don't need to qualify the name of the Control:
=DLOOKUP("Description","[Color]","ColorCode='"&[ThirdJoined]&"'")