Using the Replace function
Hi allI have a column called supplements and it has values such as
1. the payment is > 90 days
2. the payment is < = 10 days
Now, I want to use the Replace function to replace > and < to "greaterthan".
and 'lessthan' RESP, but the problem is that, in the function replace, I can give that one argument. So what I do is in the region of fx for the column
Replace (supplements,' > ',' greaterthan')
This replaces the > sign very well with string greaterthan and show me values such as
1. the payment is greaterthan 90 days
2. the payment is < = 10 days
but I want to replace < "lessthen" also, how can I do? Can I undergo two replace statements? How can replace several string or special characters for a single column?
Help, please.
Thank you
Ronny
Try this
CASE
WHEN supplements LIKE ' % > %' THEN Replace(latepayment,'>','greaterthan')
WHEN supplements LIKE ' %<=%' then="">=%'><>
END
Tags: Business Intelligence
Similar Questions
-
problems using the replace() function
Hey everybody. :)
I wrote a query that finds the address of a company (5 columns and concatenates into one). These columns are street, city, County, telno and faxno.
Some of the companies have a null value for the County, that is when I write the query that it returns a similar result to... 3 main Street, Manchester, 0384758948, 04857846927, but if there was a County it would be 3 Main Street, Manchester, Greater Manchester, 0384758948, 04857846927.
I tried to write the query then if it is not a County, it removes just the comma and the address becomes 3 Main Street, Manchester, 0384758948, 04857846927... but I can't seem to understand so I thought I'd come and ask the professionals. :)
set linesize 100
column suppname heading "name of the provider.
Select suppname, street | ', ' || City | ', ' || County of | ', ' || Zip code | ', ' || telno | ', ' || faxno "address of supplier.
from suppliers
where the County is null
Replace (County, County, ");
It gives me an error "command not completed successfully", but I can't for the life of understand me why.
Thank you in advance. :)If the County is optional, you can concatenate the like this:
select suppname, street || ', ' || town || ', ' || nvl2(county, county||', ', null) || postcode || ', ' || telno || ', ' || faxno "Supplier Address"
(you can do the same for the other columns if necessary)
-
How to use the add_months() function in a mapping?
Hello
I have a variable in ODI with a date and I need to add another variable to add 'x' months...
How can do that?
Thank you
If you say you have variable1 organise a date for example 01/01/2015 and variable 2 holding a certain number of months for example 7?
If so in your mapping expression simply use the date functions available to your database technology (step/target) and replace the variable in the function
that is for Oracle your mapping would be ADD_MONTHS (#Variable1,Variable2of #)
-
alternatives without using the regexp_replace function
SELECT
REGEXP_REPLACE (phone_number,
"([[: digit:]] {3})------." ([[: digit:]] {3}). ([[: digit:]] {4})',
"\2-\3 (\1)") "REGEXP_REPLACE.
Employees;
is there another without using the regexp_replace function...
Another way
(eliminating instr... function as your problem focuses on one length fixed)
WITH t AS (SELECT '112.345.6789' FROM DUAL str).
TT AS (SELECT REPLACE (str, '.') t str)
SELECT ' (')
|| SUBSTR (str, 1, 3)
|| ') '
|| SUBSTR (str, 4, 3)
|| '-'
|| SUBSTR (str, 7)
TT;
See you soon,.
Manik.
-
Hi all
I want to use the function NOW with a different operator in obiee11.1.1.6.11 or 11.1.1.7.1
but every time I have a creating a filter as
TRAN_DATE is equal to NOW()-120, we become "an arithmetic operation is being performed on a non-digital type.»
11.1.16.11 and 11.1.1.7.1
Hare TRAN_DATE is in RPD datetime data type
Can someone tell me how to replace the error and make the report run and return the results
Do now () - 120 is a very simplistic way to look at it because it is highly ambiguous. IE: NOW less 120 "what?" Minutes? Seconds? Years? Petroleum products?
Accuracy is the key. Now() gives a timestamp (a real timestamp DATA TYPE object!), so I guess you mean days.
Timestamp data types are changed (projected through time) using the TIMESTAMPADD function, which in your case would by this formula:
TIMESTAMPADD (SQL_TSI_DAY,-120, NOW()))
-
help in the application without using the pivot function
Hi gurus,
Can you please help write the query without using the PIVOT function.
Thanks in advance!...WITH indata AS (SELECT 1 sn, '123:456,789,323:456,213,344,345:5454' x from dual UNION ALL SELECT 2, 'abcd:fgrfr,rfrf,rfred,tg:tg,tg:ophhh,op,vdfgbh:poijn' x from dual), instr AS (SELECT a.SN, rownum RN, B.column_value || CASE WHEN B.column_value NOT LIKE '%:%' THEN ':' END column_value FROM indata a, TABLE(CAST(multiset (SELECT trim(SUBSTR(x, (CASE LEVEL WHEN 1 THEN 1 ELSE instr(x, ',', 1, LEVEL - 1) + 1 END), (CASE instr(x, ',', 1, LEVEL) WHEN 0 then 4000 ELSE instr(x, ',', 1, LEVEL) - 1 - (CASE LEVEL WHEN 1 THEN 0 ELSE instr(x, ',', 1, level - 1) END) END))) FROM dual CONNECT BY level <= LENGTH(x) - LENGTH(REPLACE(x, ',', '')) + 1) AS sys.odcivarchar2list)) b) SELECT col1_val2, col1_val1, col2_val2, col2_val1, systimestamp FROM (select SN, ROW_NUMBER() over(partition by SN order by RN) RN, SUBSTR(column_value, INSTR(column_value, ':') + 1) VAL1, substr(column_value, 1, instr(column_value, ':') - 1) val2 FROM instr ) PIVOT(MAX(VAL1) VAL1, MAX(VAL2) VAL2 FOR SN IN(1 as col1,2 as col2));
Any help would be appreciated.user590978 wrote:
Can you please help write the query without using the PIVOT function.
with indata as ( select 1 sn,'123:456,789,323:456,213,344,345:5454' x from dual union all select 2, 'abcd:fgrfr,rfrf,rfred,tg:tg,tg:ophhh,op,vdfgbh:poijn' x from dual ), t1 as ( select x from indata where sn = 1 ), t2 as ( select x from indata where sn = 2 ), t3 as ( select level lvl, substr( x, instr(',' || x,',',1,level), instr(x || ',',',',1,level) - instr(',' || x,',',1,level) ) col1 from t1 connect by level <= length(x) - length(translate(x,'A,','A')) + 1 ), t4 as ( select level lvl, substr( x, instr(',' || x,',',1,level), instr(x || ',',',',1,level) - instr(',' || x,',',1,level) ) col2 from t2 connect by level <= length(x) - length(translate(x,'A,','A')) + 1 ), t5 as ( select lvl, substr(col1,1,instr(col1 || ':',':') - 1) col1_val1, substr(col1,instr(col1 || ':',':') + 1) col1_val2 from t3 ), t6 as ( select lvl, substr(col2,1,instr(col2 || ':',':') - 1) col2_val1, substr(col2,instr(col2 || ':',':') + 1) col2_val2 from t4 ) select col1_val1, col1_val2, col2_val1, col2_val2, systimestamp from t5 full join t6 on ( t6.lvl = t5.lvl ) order by coalesce(t5.lvl,t6.lvl) / COL1_VAL1 COL1_VAL2 COL2_VAL1 COL2_VAL2 SYSTIMESTAMP ---------- ---------- ---------- ---------- ------------------------------------- 123 456 abcd fgrfr 23-OCT-12 11.50.12.015000 AM -04:00 789 rfrf 23-OCT-12 11.50.12.015000 AM -04:00 323 456 rfred 23-OCT-12 11.50.12.015000 AM -04:00 213 tg tg 23-OCT-12 11.50.12.015000 AM -04:00 344 tg ophhh 23-OCT-12 11.50.12.015000 AM -04:00 345 5454 op 23-OCT-12 11.50.12.015000 AM -04:00 vdfgbh poijn 23-OCT-12 11.50.12.015000 AM -04:00 7 rows selected. SQL>
SY.
-
'&;' in the Replace function
Hi all
I use the replcase function in generatig xml as below
Select Replace ("Test & New", "&", "& amp ;')") Double;
It asks me to enter the value (this is to be considered as subtitute value). How can I manipulate '&' in the function replcase to replace the respective value.
Thanks in advanceThis can be useful
Escape the sign & (and) in queries -
How doi send texts using the speech function without hitting the Send button?
using the speech function in texting, how to send the text without actually pushing the Send button? When I say 'send' or 'send message' he just keeps typing
"Hey, Siri, send a message to Bob. Siri will then ask you what you want text Bob. Once you stop dictating, Siri will ask then if you're ready to send the message. Say, "Yes." It's really very nice.
If you are already in the message app and using speech-to-text, you must press the Send button.
-
Cannot use the Val function in a script use
I'm trying to convert a text string (binary number) in a number by using the Val function in a script of use but the colors of tiara the term Val in red and the script produces an error indicating "Variable is undefined:"Val"
Why is that happen? Some functions are not allowed in use scripts?
In addition, it seems impossible to use debugging in my use - if I try to add a variable to the Watch window, there never have any value even if I put a breakpoint on this line of code. Would it not possible to debug scripts use?
David,
regarding your question on "Val" I would like to direct you to the "File.Formatter.ParseString" function which is part of the API available at DataPlugins.
CDbl and CLng do a good job in general, but they are dependent on the local configuration of the PC. 'ParseString' is so much more reliable.
Andreas
-
How to connect the parallel test using the logarithmic function Teststand database result
Hello
How can I connect a test result of 4 EHR tested in parallel using the logarithmic function Teststand database
I use Labview 2013, 2013 Teststand and sequential model.
The test is performed using a single digital card (SMU-6556). The FSD 4 is connected to the port of the digital map and is tested in parallel.
Currently at the end of the test, I would have a report with all the measures, but I need 4 reports (1 report / dut)
TKS
-
When I use the library function node call in real time, is loaded only once for all or load the DLL every time when it is called?
I have a critical application in real time, in which I use a piece of DLL function developed in C++. It is ok? Make sure any senior developer?
Thank you in advance.
The user interface thread is the thread that is used to update the user interface. It's slow. And it's supposed to be that way because humans are slow.
The call library function node can be configured as this thread to use in the configuration for it dialog box. Please visit the LabVIEW documentation on how to do this.
-
How can I use the BCGTransform function to treat the 16-bit Image?
Hi ~
I use LabWindowsCVI8.5 and NI Vision to make the treatment of the Image. When I read the "IMAQ Vision for LabWindowsCVI Reference Manual", I found that the imaqBCGTransform function only supports 8-bit Image, while I do the BCG to turn on 16-bit image. Are there solutions to use the BCGTransform function to deal with the 16-bit Image? Or any other feature that could make the correction Gamma, contrast and brightness on the 16-bit Image?
Thank you very much!
because imaqBCGTransform is implemented as a lookup table, we can understand why it is limited to 8-bit images.
Now let's take a look at the definition of each of this mandate (from the NI Vision Concepts documentation):
-brightness: a constant added to the components red, green, and blue pixel of color over color, decoding of the process;
-contrast: a constant multiplication factor applied to the components of the luma and chroma of a pixel of color in color to decoding process.
-gamma correction: expand high gray-level information in an image while removing information of low level of gray. (the chapter on lookup tables gives some examples of corrections gamma)
now that you understand that this transformation is a simple mathematical function, simply calculate the correction for each pixel on your 16-bit images.
I know not the exact formula used by the imaqBCGTransform function, but you should be able to approach by performing some tests on images 8 bits with the original function... or you can make your own formula... or find one on the net... or you can ask someone at home OR you give the formula...
-
Does anyone have an example VI for using the SendInput function in User32.dll?
Hi all
I am creating a VI that creates a click of the mouse. I looked at the MSDN Web site and found that I need to use the SendInput function in User32.dll. The problem is that some of the parameters for this function are nested structures. How to use this function in a call library function node? Is there already a LabVIEW wrapper for this function?
Thank you
MechEman
I would use rather MouseEvent. I looked at my VI and it can be cleaned up a bit, but it works for what you want to do.
-
Using the comparison function where 2 data tables various types
Is it possible to use the comparison function in Labview you to compare 2 arrays of types of different data (e.g. Boolean and double-precision)?
Would this work? Nested for loops of index on the TRUE values of the Boolean table.
-
How to copy an image that is in format .pdf using the paint function paste in Word?
I would like to copy a table that is in a non-protected PDF document using the paint function in accessories to paste it in a Word document that I'm working on. Please help as soon as POSSIBLE.
Hello, Edward Namalima,.
1. first open the pdf page you want to copy.
2. when the page is displayed on your screen, press prtscrn on your keyboard.
3. a copy of the screen has now sent in the windows clipboard.
4. now open Paint.
5. on the Paint toolbar, click on edit and then click on paste. The image will now be pasted in a Paint window. You may need to accept a dialog resize if the image is larger than the current document.
6. now, from the toolbar to the left of your screen, click on the Selection (the oblong dotted box) tool. With the selection tool, select the entire surface of the table you want to copy. Once selected, click on modifier change again, then select Copy.
7. now, open Microsoft Word.
8. then place the cursor where you want the table to set, and then press the CTRL and V together on your keyboard.
9. the image of the table should now be pasted into your Word document.
Alternatively, you can use the cutting tool (click on the Start button and type snipping tool in the search field). Select the table you want in the pdf page using the cutting tool and then open word and paste the table in word.
This forum post is my own opinion and does not necessarily reflect the opinion or the opinion of Microsoft, its employees or other MVPS.
John Barnett MVP: Windows XP Expert associated with: Windows Expert - consumer: www.winuser.co.uk | vistasupport.mvps.org | xphelpandsupport.mvps.org | www.silversurfer-Guide.com
Maybe you are looking for
-
How to change the serial number when the system board is replaced
How can I change the serial number of the system in the bios of a D530 SSF when replacing the motherboard?
-
My son ipad mini sounds when my iphone how can I stop this?
My son ipad mini rimgs when my iPhone6 is how to stop this please?
-
Help with a Fujinon Cabrio 19-90 on an F5
Hello! Usually, I'm able to find what I need in these conversations, but I'm having a particularly delicate delivers the two Sony, and support of Fujinon were unable to help me with. I just brought our Cabrio Fujinon lens to get a firmware update, ve
-
Tecra M7 - features of the utility of logon access Code
The functionality of logon access Code of the Tablet does not work. The installer works fine until you enter the code, when I try to write in the box made unbranded and I so can't further in the wizard.Does anyone else have this problem? Thanks in ad
-
My toshiba windows 7 continues to try to update, get to 68%, then comes back. I can't do something... off, open in safe mode, so I can use it. It is only 18 months old has been in stock 8 months. It doesn't help. Can I recover? or go buy another