Substring only the numeric values and sum It
Hi All,
I have Department Dim Object and Equivalent Base Detail Object. I have created the department as section. And the values for the Equivalent Base displays as follows
Department 1
16 OUNCE
288 OUNCE
Department 2
UNIT
12 COUNT
Required Output:
Total Equivalent Base
Department 1
304
Department 2
12
now I need to to display only the Total Sum of Equivalent base for each department.
First I tried to substring
=Substr([Equivalent Base];1;3)
And then I tried to sum it
=sum(Substr([Equivalent Base];1;3))
its giving me #Error
Regards,
Rahul Akurathi
Hi Rahul,
Is the following your source data?
Col1, Col2
Department 1,16 OUNCE
Department 1,288 OUNCE
Department 2,UNIT
Department 2,12 COUNT
And you want to get?
Department1, 304
Department2, 12
If so my code did not allow for the Unit which had no number.
you will need something like
if(pos(([equilvant base]," ")>0;(if (IsNumber(trim(substr([equilvant base];1;pos(([equilvant base]," ")-1));sum(ToNumber(trim(substr([equilvant base];1;pos(([equilvant base]," ")-1)));0);0)
The logic here is if there is no space then it does not contain a number, therefore use 0. If it has a space check the characters up to the space and see if they are a number. If yes convert to a number, otherwise use 0.
Let me know how you get on
Alan
Similar Messages
-
Using substring to pick the numeric value from a string failing
Hi,
I have a string like fffd_1234.com from this I need to pick the numeric value from which is in between the _ and . , for that I have wriiten the expression as
Reverse(SUBSTRING( REVERSE( "fgfg_asdd.com" ),
FINDSTRING(Reverse( "fgfg_asdd.com" ), ".", 1 )+1 ,findstring(
Reverse( "fgfg_asdd.com" ),"_",1 )-FINDSTRING(Reverse("fgfg_asdd.com"
), ".", 1 )-1))
This is throwing me the error or its giving me with the result with _123.Why all the "reverse" calls? Do you expect underscores or periods to occur more than once in the file name?
This should work:
SUBSTRING("fffd_1234.com", FINDSTRING("fffd_1234.com", "_", 1) + 1, FINDSTRING("fffd_1234.com", ".", 1) - FINDSTRING("fffd_1234.com", "_", 1) - 1)
Talk to me now on -
Prepopulated Barcodes only show the numeric code and the the Barcode itself
Hi
I created a PDF-Form that is filled by a small C#-program. That works pretty well. In my form is a 3of9 barcode. I can prepopulate it, like any other field. BUT: If I open the prepopulated pdf-file there is no barcode but only the numeric number, the barcode should display. If I CHANGE this number the right barcode will be displayed.
Any hints?
JanDoes the change to the field occur while the user is typing in numbers, after they exit the field, or after clicking a button to submit the form? I ask because that could help determine where the validation is occurring. It might not be part of the XML for the text/number field at all.
For instance, here's an example of a field that has a ssn validation pattern, a button that checks to ensure the number entered is divisible by 9, and a script on the change event to be sure it stops at 9 characters. Since each part of that takes place at a different point, the two scripts and pattern are spread out. I included the XML and where they came from. -
Limiting entry in a JTextField to numeric value and "%" value
Hi,
I want to allow the user to enter numeric value and % value
How can I limit the user to make such a entry in JTextFieldUse the code given below to make your textfield accept only numeric values. You can modify itto include % values too.
textField.setDocument( new TextFieldVerifier() );
class TextFieldVerifier extends PlainDocument {
public void insertString( int offset, String str, AttributeSet attSet ) throws BadLocationException {
boolean valid = false;
if ( str == null ) {
return;
String old = getText( 0, getLength() );
/* insert the new string at the given offset, into the old string */
String newStr = old.substring( 0, offset ) + str + old.substring( offset );
try {
/* check if the new string is a valid integer */
Integer.parseInt( newStr );
valid = true;
} catch ( NumberFormatException ne ) {
/* invalid, if not an integer */
valid = false;
Toolkit.getDefaultToolkit().beep();
if ( valid ) {
super.insertString( offset, str, attSet );
} -
Hi All,
I have created a form with 5 blocks (namely ENQACMHDR, ENQACMDTL, ENQACEHDR, ENQACEDTL, ENQACSPEC), where i have 8 push buttons (namely ENTER_QUERY, EXEC_QUERY, CLEAR, FIRST, NEXT, PREVIOUS, LAST & EXIT).
This form is created just for viewing purpose only. So after I execute, all the blocks have been blocked against insert & update.
I query on 2 fields that is 'ENQNO' and 'RATNG' (Both the fields belong to the block ENQACMDTL).
When I click on 'EXEC_QUERY' directly, all the data of all the years populates.
But the user wanted the data to be populated from only the present year and the previous year.
So , on 'WHERE Clause' of the property_palette of 'ENQACMDTL' block , I put in the following condition:
SUBSTR(ENQACMDTL.ENQNO, 1,4)=TO_CHAR( ADD_MONTHS(SYSDATE,-12) , 'YYYY') OR SUBSTR(ENQACMDTL.ENQNO, 1,4)=TO_CHAR(SYSDATE, 'YYYY')
PROPERTY PALETTE (ENQACMDTL block)
WHERE Clause
SUBSTR(ENQACMDTL.ENQNO, 1,4)=TO_CHAR( ADD_MONTHS(SYSDATE,-12) , 'YYYY') OR SUBSTR(ENQACMDTL.ENQNO, 1,4)=TO_CHAR(SYSDATE, 'YYYY')
Now the data of only the present year and the previous year is being populated. Its ok with the field of 'ENQNO'.
The problem is when i query on field 'RATNG' . 'RATNG' is a Text_item with Number of Items displayed=5. (5 rows)
The following are 2 columns of a Table (Name=ENQACMDTL) in Database.
ENQNO
RATNG
2013900054
500KC2
2013900047
800KC4
2013520018
750KC6
2012900037
1000KC2
2012520109
500KC2
2012140019
750KC6
2011540036
500KC2
2011100030
1000KC2
2006100007
90KD8
2006750014
750KC6
2006900072
500KC2
The first 4 numbers of 'ENQNO' denotes the year. There are more than a lakhs of records.
So when i query on the field 'RATNG',
Example:For RATNG=500KC2;
I click on ENTER_QUERY, On the field of 'RATNG' , i put in the value 500KC2 and click on EXEC_QUERY; Details with respect to 500KC2 is displayed as well as all the other unwanted RATNG like 750KC6, 1000KC2 (which belongs to the ENQNO of the present year and the previous year) also gets displayed.
I want details of only RATNG (500KC2) to be displayed, but only of the present year and the previous year, that is 2013900054, 2012520109 (ENQNO).
Other than 500KC2 RATNG, no other RATNG must be displayed.
The RATNG=500KC2 is also present for ENQNO=2011540036 , 2006900072. But I dont want these to be displayed.
I want only the data or details of the present year and the previous year to be displayed or populated with respect to the given RATNG.
Can You Help me or tell me what do i do for this?
Hope I'm clear with my question!!
If my question is not clear, let me know plz.
Thank You.
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
Oracle forms 6i.On key-exeqry you have to program. Delete all other trigger codings for checking your condition.
It dint work on key-exeqry.
I tried key-exeqry on form trigger, block (enqacmdtl) and also on field(:enqacmdtl.enqno) , but none of them worked.
It did not display the message.
I have a 'PUSH-BUTTON:EXEC_QUERY.
For EXEC_QUERY, Trigger : WHEN_BUTTON_PRESSED;
I added the following code:
if to_number(substr(:enqacmdtl.enqno,1,4))<to_number(to_char(add_months(sysdate,-12),'YYYY')) then
message('The Rating is not present for the present year and the previous year');message(' ',no_acknowledge);
raise form_trigger_failure;
else
execute_query;
end if;
It is working fine and the message is being displayed.
But again I have a new problem and that is;
On the field :enqacmdtl.enqno, when i enter the '2013%' and press 'EXEC_QUERY', it works fine.
but when i enter '2006%' and press 'EXEC_QUERY', it shows the following error
FRM-50016: Legal characters are 0-9 - +E. It does not display the message also.
but when i enter the complete number, '2006580002', then it works fine , that is it displays the message (The Rating is not present for the present year and the previous year).
The problem is because of '%', only when i put in the restricted data (which does not satisfy where condition).
How do i solve this?
Thank You Priyasagi. -
How to get the numeric value of DocTotal from UI API
When I hit the ADD button I need to get the DocTotal from the UI API !
All I have is the EditText which gives it in string and the problem is to double.Parse it
it's a pain to do it while there is CultureInfo related issue with it.
So It would be wise to get the numeric value directly from the UI API instead of getting the DocTotal by string and trying to convert it. So is there any way to get the numrci value of DocTotal from UI API ?Hello Marc,
Here is a function which considering the Culture Info and always working. You can speed it up by using extending admininfo to global vairables, and loading the values at startup of the addon.
Use the oEditText.value.ToString() to convert into into the doulbe number:
Public Function _string2double(ByVal s As String) As Double
Dim d As Double
' This part is fast, when regional settings equal to sap B1 settings:
Try
d = Convert.ToDouble(s)
d = Math.Round(d, 6)
Return d
Catch
End Try
' Speed up performance: extend CompaneService variables to global variables and query them at addon startup.
Try
Dim nfi As System.Globalization.NumberFormatInfo = System.Globalization.CultureInfo.CurrentCulture.NumberFormat
Dim oCompanyService As SAPbobsCOM.CompanyService = oCompany.GetCompanyService()
Dim oAdminInfo As SAPbobsCOM.AdminInfo = oCompanyService.GetAdminInfo()
Dim sbodsep As String = oAdminInfo.DecimalSeparator
Dim sbotsep As String = oAdminInfo.ThousandsSeparator
If s.IndexOf(Space(1)) > 0 Then
If oAdminInfo.DisplayCurrencyontheRight = BoYesNoEnum.tYES Then
s = s.Substring(0, s.IndexOf(Space(1)))
Else
s = s.Substring(s.IndexOf(Space(1)), s.Length - s.IndexOf(Space(1)))
End If
End If
Dim s1 As String = s.Replace(sbotsep, nfi.NumberGroupSeparator)
s1 = s1.Replace(sbodsep, nfi.NumberDecimalSeparator)
d = Convert.ToDouble(s)
d = Math.Round(d, 6)
Return d
Catch
Return 0
End Try
End Function
Regards,
J.
Edited by: János Nagy on Oct 7, 2009 8:55 AM -
Numeric value and scientific notation
Hi,
with Oracle 8 or 10, the query (via TOAD or my app : Delphi + BDE)
SELECT 0.0008 FROM DUAL returns 0.0008,
but the query
SELECT 0.00008 FROM DUAL returns 8E-5.
Is there a way to avoid this display in scientific notation, except changing all my queries ? Or to push the limit for this display one digit later ?
Maybe with an Oracle parameter ?
Thanks for your help !duplicate for thread
numeric value and scientific notation -
I need to create a image using some numeric values and i want to display values in image,
I need to create a image using some numeric values and i want to display values in image, Numeric values be enterd by text file, excel file or user input by dialog box,
this is the sample if image.
http://s17.postimg.org/5xvtzbztn/5_01_03_I.png
128 x 16 Pixels , Back ground Black, Numbers in Red, Should be same as above picture.
Because i have hundreds of images to create like this.
If any one can make a script for this it is very good.
Sorry about my English.
Thank you.Have you checked out data driven graphics?
https://helpx.adobe.com/photoshop/using/creating-data-driven-graphics.html -
Query only non numeric values in a column
How to query only non numeric values in a cloumn.
For example:
Table1 has a column1(col1)
Values:
Row Value
1 27376
2 47D99
3 83039
4 DKFI*
5 3J6
Query should retrieve only rows(2,4,5).
Thanks! for help
MuraliVersion 2(PL/SQL) above is not clear enough, It can be tuned to the following:
-- Create a function
Create or replace function IsVARCHAR(pCol VARCHAR2) return VARCHAR2
AS
vNumber NUMBER := 0;
begin
vNumber := to_number(pCol);
RETURN NULL;
Exception
When Others Then
RETURN pCol;
End;
-- To See VARCHAR values (alpha-numeric) only!
SELECT col1 FROM tab1
WHERE IsVARCHAR(col1) IS NOT NULL;
-- To See NUMBER values only!
SELECT col1 FROM tab1
WHERE IsVARCHAR(col1) IS NULL;Versatility here with PL/SQL, but I personally like SQL versions.
Thx,
SriDHAR -
I can not run the scanner in my main user, but only the second user and the same thing with updating apps! Why is this happening???
Welcome to the Apple Community.
Enter the details of her second account at system preferences> mail, contacts & calendars. -
Retrieve data from a text file, incrementing the last value and save new value below
Hi
This was working initially. It is part of my LabView Project. I was trying to create a unique number that increments every time the adds the value to the list. It works on computer perfectly. But when I put this on a PDA, it seems to create a blank space when reading the contents of the text file after the last value, which means 0 + 1, which is not what I want.
Please run the testUniqueNoOnPDA.vi first and change the path to C:\uniqueNumber.txt and save the uniqueNumber.txt file to your C drive and see What I am trying to do. Click the Enter button to increment.
Why does the PDA create a blank space after the last value and a computer does not?
I was working perfectly all week and it is not working well now.
Help please, I think I'm missing something
Attachments:
uniqueNumber.txt 1 KB
testUniqueNoOnPDA.vi 33 KB
testUniqueNoOnPDA.lvproj 4 KBIt works perfectly, it was a hardware problem. It depends on what PDA I used.
-
I would like to know how i can create a bell graph with out using sub VIs, the data that i created consists in 500 readings with values of 0 to 100, i calculated the mean value and standard diviation. I hope some one can help me
Here's a quick example I threw together that generates a sort-of-bell-curve shaped data distribution, then performs the binning and plotting.
-Kevin P.
Message Edited by Kevin Price on 12-01-2006 02:42 PM
Attachments:
Binning example.vi 51 KB
Binning example.png 12 KB -
I have upgrade to IOS 8 and all Fotos are ereased on my Iphone and on my Computer is only the last Backup and there a no Photos now what can i do?
You really need to try this on a computer, not on the iPad.
Seeing how what is in the cloud is also on the iPad, if the content is not on the iPad, there is a good chance that the content is lost. But you can try logging into www.icloud.com in a web browser on a computer and log into your account and see if you can get into the Pages app. You may have to sign up for iCloud drive if you didn't do so already. Make SURE you that you read the blurb that will pop up in that window in iCloud for more information. -
Upon entering a LV project file into VSS, all files in the project are left out. Only the project shell and settings enter VSS. Any idea why?
Solved!
Go to Solution.Chuck72352,
Hello! It is my understanding that you need to add the individual files to the Source Code Control along with the .lvproj file.
Here is a great deal of information on Source Code Control Practices in LabVIEW.
Ben Sisney
FlexRIO V&V Engineer
National Instruments -
How to retrieve the procedure value and pass the value to a form field
How to retrieve the procedure value and pass the value to a form field?
Set property for the field and the value is the actual procedure/function.
Cheers
Maybe you are looking for
-
Severe battery drain with iOS 8.1.2
I am having severe battery drain issues with iOS 8.1.2 with all my iOS devices (iPhone 6, iPhone 5s, iPad Mini Retina, iPad Air). I can have my device in DND mode overnight with 100% battery, then the following morning I will wake up to find my devic
-
Customer Aging Report totals and detail is different
Hi Experts, I have a customer aging report and i find something odd with the total column in local currency and System Currency. for Example : Customer _______Total_______Future Remit_______0-30________31-60________61-90________90+ ____A100 _______
-
Problem with instantiating array
Hi, so my problem is 2 fold :) First off, here are my constructors: public class ArrayBag implements BagADT<Object> { public Object[] bag; private int bagSize = size(); public ArrayBag() { bag = new Object[100]; public ArrayBa
-
Little problem with Shape.intersects
I have the following code: boolean isCollision = island.contains(line.getP1()) || island.contains(line.getP2()) || island.intersects(line.getP1(), line.getP2(), 1, 1);This doesn't work: The method intersects(double, double, double, double) in the typ
-
How to use SharePoint Metadata in MS Excel
Hi, I would like to use the metadata from a SharePoint library in an Excel file without a VBA scripts. How can I get these metadata into an Excel file? Thanks in advance.