Display Alphabetic Ordered List in Oracle Apex page - oracle-apex

I am using Oracle Apex 5 and wanted to display a beverage list in my page in alphabetic order like this (example).
a. Coffee
b. Tea
c. Juice
For this I have used PL/SQL block and used the code below (example) :
BEGIN
sys.htp.prn('<ol type = "a">');
sys.htp.prn('<li>' || 'Coffee' || '</li>');
sys.htp.prn('</ol>');
END;
But it is showing me list in number instead of alphabets like below:
Coffee
Tea
Juice
Am I doing something wrong here. Please help. Thanks in advance.

Also asked here
https://community.oracle.com/thread/3978246
Short answer would be try this
<ol style="list-style-type: list-alpha;">

Related

Using regextract and importrange together make a "duplicate" formula

I have a spreadsheet where I look if the data (website) already exist on the master sheet.
=if(countif(importrange("Spreadsheet Key","Leads!N:N"),K2)>0,"COMPANY EXISTS!","")
But the above formula is not dynamic enough. If there are companies with co.uk and on the master sheet if it's registered under .com, it won't show "COMPANY EXISTS!"
So I changed to the formula to look for works after before and after "." on a website.
=ARRAYFORMULA(REGEXEXTRACT(UNIQUE(SUBSTITUTE(importrange("Spreadsheet Key","Leads!N:N"),"www.","")), "([0-9A-Za-z-]+)\."))
But it's not working if I try to incorporate with if and countif.
=if(COUNTIF(ARRAYFORMULA(REGEXEXTRACT(SUBSTITUTE(importrange("Spreadsheet Key","Leads!N:N"),"www.",""), "([0-9A-Za-z-]+)\."),L2:L)>0,"Company Exist!",""))
It shows 'Wrong number of arguments to IF. Expected between 2 and 3 arguments, but got 1 arguments'
Can anyone help me out on where I am making the mistake?
Spreadsheet link- https://docs.google.com/spreadsheets/d/1La3oOWiM5KpzRY0MLLEUQC25LzDuQlqTjgFp-VlS8Bo/edit#gid=0
Edited: Made a mistake beforehand, didn't specify on that cell its looking against
Your formula had a typo. You are not closing the Arrayformula and the Countif correctly (the array formula closing parenthesis should go before the , of the count if). So change this:
=if(COUNTIF(ARRAYFORMULA(REGEXEXTRACT(SUBSTITUTE(importrange("Spreadsheet Key","Leads!N:N"),"www.",""), "([0-9A-Za-z-]+)\."),L2:L)>0,"Company Exist!",""))
To this:
=if(COUNTIF(ARRAYFORMULA(REGEXEXTRACT(SUBSTITUTE(IMPORTRANGE("Spreadsheet Key","Leads!N:N"),"www.",""), "([0-9A-Za-z-]+)\.")),L3:L)>0,"Company Exist!","")
I hope this has helped you. Let me know if you need anything else or if you did not understood something. :)
try:
=ARRAYFORMULA(IFNA(IF(IFNA(REGEXEXTRACT(SUBSTITUTE(IMPORTRANGE(
"1bnz7Y_xVN9Jo80aCBBeMBMJBnMDHkbZQUWnmL20CRi8", "Leads!N:N"),
"www.", ), "([0-9A-Za-z-]+)\."))>0, "Company Exist!", )))

Parsing a name from a complex string in Tableau

I have a series of values in Tableau that are long strings intermixed with letters and numbers. I am unable to control the data output, but would like to parse the names from these strings. They follow the following format:
Potato 1TByte 4.5 NFA
Board 256GByte 553 NCA
Launch 4 512GByte 4.5 NFA
Launch 4S 512GByte 4.5 NCA
From each of these, I am attempting to capture the following:
"Potato"
"Board"
"Launch 4"
"Launch 4S"
Each string follows the same format: the name, followed by size, followed by some extra information we don't really care about.
I've tried to put together some text parsing strings, but am coming up short, and am still trying to learn regular expressions.
The Tableau calculated field I was trying to work with was something like the following:
LEFT([String], FIND([String], "Byte") - 2)
The issue is that the text and numbers preceding Byte can be anywhere from 4 to 2 characters and I need a way to identify the length of that.
Any help would be greatly appreciated!
One option which uses a regex replacement:
REGEXP_REPLACE('Launch 4 512GByte 4.5 NFA', ' \d+[A-Z]Byte .*$', '')
This strips off everything from the Byte term to the right, leaving us with only the product name.
You could try the following - this seems to work - Screenshot of Tableau output. Find below the formulas for the various derived columns you see in the screenshot (Your source column is called [Name])
Step1 = LEFT([Name],FIND([Name],"Byte")-1)
Step2 = LEN([Step1])-LEN(REPLACE([Step1]," ",""))
Step3 = FINDNTH([Step1]," ",[Step2])
Step4 = LEFT([Step1],[Step3]-1)
And of course you can nest all these in a single calculated field - kept them as separate columns for easier understanding

How to get count of item repetition in a list?

Hi i have a list in the following format
tweets= ['RT Find out how AZ is targeting escape pathways to further
personalise breastcancer treatment SABCS14', 'Did you know Ontario has
a special screening program for women considered high risk for
BreastCancer', 'Article Foods That Prevent BreastCancer','PRETTY
Infinity Faith Hope Breast Cancer RIBBON SIGN Leather Braided Bracelet
breastcancer BreastCancerAwareness']
I have just given a sample of list but it has a total of 8183 elemets. So now if i take 1st item in the list i have to compare that with all the other elements in the list and if 1st item appears anywhere in the list i need the count how many times it got repeated. I tried many ways possible but couldnt achieve desired result. Please help, thanks in advance.
my code
for x, left in enumerate(tweets1):
print x,left
for y, right in enumerate(tweets1):
print y,right
common = len(set(left) & set(right))
As already pointed out in comments, you can use collections.Counter to do this. The code will translate into something like below:
from collections import Counter
tweets = ['RT Find out how AZ is targeting escape pathways to further personalise breastcancer treatment SABCS14',
'Did you know Ontario has a special screening program for women considered high risk for BreastCancer',
'Article Foods That Prevent BreastCancer',
'PRETTY Infinity Faith Hope Breast Cancer RIBBON SIGN Leather Braided Bracelet breastcancer BreastCancerAwareness']
count = Counter(tweets)
for key in Count:
print key, Count[key]
Note that the Counter is essentially a dict, and so the order of the elements will not be guaranteed.

how to do max-match search in JCS (java caching system)

I am developing an application which makes use of JCS. i do know how to retrive the data from the catch when searchkey is a complete string. I need to implement max-match search in JCS.
For example : cache contains following data.
book number | book title
123 | EJB
321 | Head First Java
121 | Jsp and servlets
111 | Ant scripting
when user inputs just 1 for book number it should fetch all the book title with book number starting with 1. i.e it should list
EJB
Jsp and servlets
Ant scripting
It is the kind of search we do in sql using 'like and %' .
Kindly help me.
Thanks in advance!!!
You should be able to to do something like this:
JCSAdminBean admin = new JCSAdminBean();
LinkedList<CacheElementInfo> cacheElements = admin.buildElementInfo("myCache");
for (CacheElementInfo e : cacheElements) {
if (e.getKey().startsWith("1")) {
//do something.. store it in a list?
}
}
Try it out and let me know if that works for you.

Extracting dollar amounts from existing sql data?

I have a field with that contains a mix of descriptions and dollar amounts. With TSQL, I would like to extract those dollar amounts, then insert them into a new field for the record.
-- UPDATE --
Some data samples could be:
Used knife set for sale $200.00 or best offer.
$4,500 Persian rug for sale.
Today only, $100 rebate.
Five items for sale: $20 Motorola phone car charger, $150 PS2, $50.00 3 foot high shelf.
In the set above I was thinking of just grabbing the first occurrence of the dollar figure... that is the simplest.
I'm not trying to remove the amounts from the original text, just get their value, and add them to a new field.
The amounts could/could not contain decimals, and commas.
I'm sure PATINDEX won't cut it and I don't need an extremely RegEx function to accomplish this.
However, looking at The OLE Regex Find (Execute) function here, appears to be the most robust, however when trying to use the function I get the following error message in SSMS:
SQL Server blocked access to procedure 'sys.sp_OACreate' of component
'Ole Automation Procedures' because this component is turned off as
part of the security configuration for this server. A system
administrator can enable the use of 'Ole Automation Procedures' by
using sp_configure. For more information about enabling 'Ole
Automation Procedures', see "Surface Area Configuration" in SQL Server
Books Online.
I don't want to go and changing my server settings just for this function. I have another regex function that works just fine without changes.
I can't imagine this being that complicated to just extract dollar amounts. Any simpler ways?
Thanks.
CREATE FUNCTION dbo.fnGetAmounts(#str nvarchar(max))
RETURNS TABLE
AS
RETURN
(
-- generate all possible starting positions ( 1 to len(#str))
WITH StartingPositions AS
(
SELECT 1 AS Position
UNION ALL
SELECT Position+1
FROM StartingPositions
WHERE Position <= LEN(#str)
)
-- generate possible lengths
, Lengths AS
(
SELECT 1 AS [Length]
UNION ALL
SELECT [Length]+1
FROM Lengths
WHERE [Length] <= 15
)
-- a Cartesian product between StartingPositions and Lengths
-- if the substring is numeric then get it
,PossibleCombinations AS
(
SELECT CASE
WHEN ISNUMERIC(substring(#str,sp.Position,l.Length)) = 1
THEN substring(#str,sp.Position,l.Length)
ELSE null END as Number
,sp.Position
,l.Length
FROM StartingPositions sp, Lengths l
WHERE sp.Position <= LEN(#str)
)
-- get only the numbers that start with Dollar Sign,
-- group by starting position and take the maximum value
-- (ie, from $, $2, $20, $200 etc)
SELECT MAX(convert(money, Number)) as Amount
FROM PossibleCombinations
WHERE Number like '$%'
GROUP BY Position
)
GO
declare #str nvarchar(max) = 'Used knife set for sale $200.00 or best offer.
$4,500 Persian rug for sale.
Today only, $100 rebate.
Five items for sale: $20 Motorola phone car charger, $150 PS2, $50.00 3 foot high shelf.'
SELECT *
FROM dbo.fnGetAmounts(#str)
OPTION(MAXRECURSION 32767) -- max recursion option is required in the select that uses this function
This link should help.
http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/extracting-numbers-with-sql-server
Assuming you are OK with extracting the numeric's, regardless of wether or not there is a $ sign. If that is a strict requirement, some mods will be needed.