Conditionally display image in Oracle Apex based on procedure - oracle

I would like to display conditionally image in the region header based on output from the procedure. Procedure is returning number from 1-5. Then number needs to be 'injected' somehow to html region :
<div style="width: 290px; margin: 0 auto;"><img src="#WORKSPACE_IMAGES#v(':P1_ID').png" width="290"></div>
so output of field :P1_ID will determine which name of the file to display. I am completely lost how I can pass any values on this level of the page.
I could try to output whole html through procedure but I am not sure if it is the best solution towards solving this problem.Any help greatly appreciated.

If the item's value is determined before the regions are rendered you can do this:
<div style="width: 290px; margin: 0 auto;">
<img src="#WORKSPACE_IMAGES#&P1_ID..png" width="290">
</div>
If the item's value can change dynamically on the page (e.g. if the value is updated by a dynamic action), you may need to write some javascript to modify the image source.
P.S. not related to your question, but the correct syntax to access the value in PL/SQL is v('P1_ID') - i.e. :P1_ID is only used where a SQL bind variable is used.

Related

ORACLE APEX Region footer text page item accessing inside page process

I have created a custom page item 'tot_credit' to get correct alignment below my tabular form report, using the below code .
,it is written in the region 'footer text'.But I am unable to access this item 'tot_credit' inside my page process(pl/sql code). It is accessible in java script code. what is the solution?
<table>
<tr>
<label>Total Credit</label> <input type="text" style="text-align:right;width:120px" name="tot_credit" id="tot_credit" >
</tr>
</table>
You can't access the item in PL/SQL because you have not defined the item in Apex. You need to define it as an Apex page item, instead of just writing the raw HTML for it.
You are probably not able to access it as the item is declared in page footer, and your pl/sql code is defined before the item declaration. Either moving the item declaration upwards on the page, or defining the pl/sql code in page footer - one of these two should solve your problem.

posting images in a form

I am using free marker in a netsuite environment. I have a custom items field that displays an image and I need this image to appear on a quote document we send to our customers when they ask about a machine. All of our machines are one-offs so I need the system to pull in that information each time, rather than post one image and use html to insert into the template. I have been able to do this with custom text fields but have not been able to make it work with an image... I am still searching the help files but any assistance will be appreciated. Just point me in the right direct...;-)
The
${record.custitemfec_custfield_image?length}
probably needs to be:
${record.custitemfec_custfield_image}
Also it looks like you are trying to print a record for an item. Is that correct? If you are trying to print a transaction you probably want:
<img src="${record.item[0].item.custitemfec_custfield_image}" style="float: left; margin: 7px" />
or
<#list record.item as line>
...
<img src="${line.item.custitemfec_custfield_image}" style="float: left; margin: 7px" />
...
</#list

Dynamically change the font size of a single character in SSRS

Using SSRS in Visual Studio 2012 I currently have the following expression in the report header.
=ReportItems!FirmName.Value
This correctly pulls the Firm name such as Client1, Client2, Client3 etc... from the body of the report.
However if ReportItems!FirmID = 600, I need the Font size of the first character in Firm name to be larger then the other characters.
This is because a particular client has a logo where the first character is larger than the others.
I tried the following expression which I know is wrong but might illustrate what I'm trying to do.
=IIF(ReportItems!FirmID.Value = 600,LEFT(ReportItems!FirmName.Value,1), "18pt", ReportItems!FirmName.Value))
So say client3 has FirmID 600 the result should be like this, you may need to run the code snippet to see what I mean...
<html>
<body lang=EN-US style='tab-interval:.5in'>
<div class=WordSection1>
<p class=MsoNormalCxSpFirst>Client1<o:p></o:p></p>
<p class=MsoNormalCxSpMiddle>Client2<o:p></o:p></p>
<p class=MsoNormalCxSpLast><span style='font-size:20.0pt;line-height:115%'>C</span>lient3</p>
</div>
</body>
</html>
I tried Ian's suggestion
which I thought was working, but I cannot yet get it to work. I can get this to work in the report body, but there are additional complications. The font size change needs to be in the Report Header, which requires referencing the report body via ReportItems! You cannot reference more than one ReportItems! in the report header or you get an error like the following
The Value Expression for the textrun Textbox12 refers to more than one report item. An expression in a page header or footer can refer to only one report item.
Yet there is one more problem and I should have clarified this in my original entry. The actual client name is like this.
Client & Associates
Both of the first letters need to be larger, but not the ampersand between them.
<html>
<body lang=EN-US style='tab-interval:.5in'>
<div class=WordSection1>
<p class=MsoNormal><span style='font-size:22.0pt;line-height:115%'>C</span>lient
& <span style='font-size:18.0pt;line-height:115%'>A</span>ssociates</p>
</div>
</body>
</html>
You can do this by creating a couple of text placeholders within the same textbox, splitting the text between these and apply a font-size expression to the first placeholder only.
See Formatting Text and Placeholders for a good overview.
In a simple example with your data:
I have a simple table to display this:
Note there are two <<Expr>> values in the last column - I have added another placeholder in this textbox.
I have split FirmName between these placeholders; in the first:
=Left(Fields!FirmName.Value, 1)
and in the second:
=Right(Fields!FirmName.Value, Len(Fields!FirmName.Value) - 1)
Even though the text is split in two expressions, it looks fine when the report is run:
Since each placeholder can have its own formatting, we can apply an expression like the following to FontSize on the first placeholder only:
=IIf(Fields!FirmID.Value = 600, "15pt", "10pt")
i.e. increase font size of the first letter for firm 600, which gives us the required results:

Extracting info from button in Ruby

I have a line of code that links to a button on a HTML page and I'm wondering is there anyway that I can extract a specific value?
<input type="button" style="cursor: pointer;" onclick="selector(item,012345)"<br />
Is there anyway that I can extract the number 012345 from the code above?
My current attempt is:
temp = doc.xpath(//div....../input)
but that returns the raw data of the whole button.
I can't tell how to select the right input without more context but in general you would do:
doc.at('input')[:onclick][/\d+/]

jqgrid 2 span elements within one custom cell?

Within my custom cell there are 2 span-elements.
<span class="FormElement">
<span class="customelement" id="code" name="code">BER01_CN_045_002</span>
</span>
Is there a way to avoid this?
See the demo, I am talking about cell "code".
I think, that you should don't spend your time in such kind of code optimization. Like I tried to explain in my previous answer the first <span> will be inserted by jqGrid for all form elements having the option edittype:'custom'. The second <span> you inserted yourself in the code of your custom formatter. It is permitted to have nested <span> elements like to have nested <div> elements. I recommend you better to follows the jqGrid standard code as trying to make any kind of optimization which nobody will see at the end except you.
Moreover if you look more in the HTML code of your page generated by jqGrid you will see that the form itself (the form with id="FrmGrid_grid" in your example) are placed inside of <span>. In the same way in the code of the column headers you will also find <span class="s-ico"> which has another two <span> elements as the children. Would you like to try to "optimize" also the code? So I repeat my advice just to hold jqGrid standards and not trying to optimize such small pieces of code like nested <span> elements.

Resources