Description string based on a formula

I am stumpped,
I am trying to write a formula so that I can return a description string from a database. My database is structured poorly so I will try to explain it as best I can. The collumns that are of intrest are my CA1 collumns which has all of my project numbers like 10230000.1 the next collumn is the WP which has an extention of the number or is blank the number looks like 10230000.100 or it is blank the next collumn is the description. I want the description to be printed when the WP is blank. I have my report grouped by the project number then by what we call the cost account (CA1) the next logical level is the work package (WP) but it is not in the report and is not needed when the WP data is blank the description collumn has the cost account description in it. Here is the formula that i have been playing with.
WhilePrintingRecords;
if{CAWP.WP}="" then {CAWP.DESCRIP} else "No Cost Account"
but i get a no cost account all of the time
any thoughts?

Hi,
IsNull(Fld) mayn't work  because some database dosen't support null values;This function will not work if the active database(s) do not support null values
Note: Zero and blank (empty or " ") are not null values
Try with keyword  HasValue(fld)
Please check the use and apply to your function.also what are the data types you are using for these fields ?
Hope it works
Thanks
Pratyush

Similar Messages

  • Item based on a formula in a custom folder

    Hi, actually I'm using Discoverer 4i and I have a problem when I create (with the administrator) an item based on a formula inside a custom folder.
    The item is based on the following formula :
    GET_THRESHOLD(Name,'XXI_SZF_SLA_Thresholds_Kormos') -- (1)
    where:
    GET_THRESHOLD is a function that returns a number
    Name is the first parameter (and at the same time another item of the custom folder)
    'XXI_SZF_SLA_Thresholds_Kormos' is an hardcoded value.
    So..when I wrote the formula into the Item Properties, this is written correctly and when I connect with Desktop or Viewer my report works correctly.
    But when I close and I re-open the administrator, I see the following formula
    GET_THRESHOLD(Name,'XXI') -- (2)
    .....how it was saved in a wrong way....or truncated....
    I tried to check also the flag "Automatically save changes after each edit"....but I see always, after I reopened the administrator, the formula (2) and not the formula (1)
    Is seems that my changes are not saved !!
    Is this a bug ? Can I fix it in some way ?
    Thanks in advance
    Alex

    hi,
    1. Try to execute the function manually by passing the same value.
    2. Discoverer formats the names of Items/folders/parameters etc by replacing underscores ("_") with a space, so this might be the reason, why it converts the value to : 'XXI SZF SLA Thresholds Kormos' and takes only the first string "XXI".
    3. Try passing a value without "_".
    Hope this helps!
    Yogini

  • How do I create a dynamic parameter based on a formula?

    Hi,
    I've developed a report, in CR 11, that is parameterized based on the field "ticket_date".  I've created a Min and a Max formula so that I can select a date range. This works wonderfully. However, my date list is growing longer by the day and each day I have to run the report I need to scroll through an even longer list of date values. This will become increasingly impractical with each passing month and year.  I would like create a "Year" paramater and a "Month" parameter so that I can first select the Year, then the month(s), then the dates.
    When I attempted to create a parameter based on the formula, "Year (), the formula wasn't in the list of available values to create a parameter on.
    How can I address this requirement?
    thanks in advance!
    Mark

    Hi Abhilash,
    Looks like I was able to create a Year field in the Command - thanks for the tip!
    Before I close this off as answered can you take a look at two sets of SQL I wrote in the Command that I'm getting errors on and offer advice on where the error is occurring.
    Example 1
    The SQL I attempted to write must be close though:
    Select ft.sequence, ft.ticket_date, coff.office_name, comp.subscriptions_id from
    field_tickets as ft, company_offices as coff, companies as comp
    INNER JOIN jobs ON comp.companies_id=jobs.companies_id
    INNER JOIN field_tickets ON jobs.jobs_id=field_tickets.jobs_id
    LEFT JOIN company_offices ON jobs.company_offices_id=company_offices.company_offices_id
    Where comp.subscriptions_id=7.00
    When I attempt to save this I get an error:
    "Failed to retrieve data from the database. Details: Exception: Error Message: Java Heap Space"
    Example 2
    I get the error, "Not unique table/alias: 'custom_jobs_values'" for the following SQL Command
    SELECT companies., jobs., field_tickets., regions., customers., custom_jobs_values. FROM
    companies, jobs, field_tickets, regions, customers, custom_jobs_values
    LEFT JOIN custom_jobs_values ON jobs.jobs_id=custom_jobs_values.jobs_id
    INNER JOIN regions ON companies.regions_id=regions.regions_id
    INNER JOIN jobs ON companies.companies_id=jobs.companies_id
    INNER JOIN field_tickets ON jobs.jobs_id=field_tickets.jobs_id
    INNER JOIN customers ON jobs.customers_id=customers.customers_id and
    companies.subscriptions_id=4.00
    thanks!
    Mark

  • How to do a TopN Sort based on a formula

    Hi all,
    My report has two groups, Store and Department.  In the details section are multiple jobs per store with costs. These are subtotalled by Store and Department.  I want to compare total spend for each store with the store budget and produce a list of the Top 10 stores based on the percentage actual spend/budget. 
    My problem is I can only do a Top 10 sort on a summary field and I cannot summarise the percentage field as this is a formula which doesn't seem to allow summaries.
    Any help much appreciated.
    Cheers,
    JD

    Jan,
    Here are a couple of options.
    1) Do the calcuations on the database (thru either a stored proc or command object).
    2) Insert a crosstab where the rows are based on the Store and the summarized field is based on the formula that outputs the percentage of the actual vs budget as a Maximum. You can then do a TopN sort on the crosstab
    Edited by: Graham Cunningham on Oct 10, 2008 8:27 AM

  • How to extract substring from a string based on the condition ??

    Hi,
    I'm having a very large string which as below
    EQD+CN+SAMPLE18767+2200+++5'
    NAD+CA+FIR:172:20'
    DGS+IMD+3.2+2346+55:CEL'
    FTX+AAA+++GOOD'
    FTX+AAA+++ONE'
    EQD+CN+SAMPLE18795+2200+++5'
    NAD+CA+TIR:172:20'
    DGS+IMD+3.2+2346+55:CEL'
    FTX+AAA+++SECOND'
    FTX+AAA+++IS FAIR'
    similarly FTX+AAA as above and it goes on
    i tokenized each segment with delimiter as ' and able to read each segment.
    Now i want to concatenate the FTX+AAA in a single segment if more than one FTX+AAA with IMMEDIATE below
    The output is as follows
    EQD+CN+SAMPLE18767+2200+++5'
    NAD+CA+FIR:172:20'
    DGS+IMD+3.2+2346+55:CEL'
    FTX+AAA+++GOOD,ONE'
    EQD+CN+SAMPLE18795+2200+++5'
    NAD+CA+TIR:172:20'
    DGS+IMD+3.2+2346+55:CEL'
    FTX+AAA+++SECOND,IS FAIR'
    similarly FTX+AAA should be concatenated if it has similar FTX+AAA IMMEDIATE below.
    The FTX+AAA segments can come any number of times immediate below
    Please help me how we can do this??? Can anyone help me with the code snippet to do this?
    Thanks,
    Kathir

    Encephalopathic wrote:
    You've posted > 300 times here and you still don't respect the rule regarding notification of all cross-posts? [http://www.java-forums.org/advanced-java/30061-how-extract-substring-string-based-condition.html]
    Do you think this this will help convince others to help you?See also [http://www.coderanch.com/t/500088/java/java/extract-substring-string-based-condition|http://www.coderanch.com/t/500088/java/java/extract-substring-string-based-condition].

  • Spliting a string based on Non Printable character

    Hi,
    i have a requirement where i have to split a String based in non printable character " MYU(ascii: 230);
    es: ""This is to test æ raaaaaaaaaaaaaaaaa æ AAA010224544 æ 7118288888 æ
    æ is a not printable character and its ascci is 230..
    iam getting that string from form how to split it in Java..
    Any suggestions...?

    One of many ways
        String initString = "This is to test æ raaaaaaaaaaaaaaaaa æ AAA010224544 æ 7118288888 æ";
        String[] tokens = initString.split(String.valueOf((char)230));
        for (String string : tokens)
          System.out.println(string.trim());
        }

  • Can a release strategy be based on a formula?

    Hi,
    A retail client i'm working on wants the release strategy PO to be based on a formula, i.e. the release strategy should have OTB check.
    Is this possible?
    Thanks in advance for your help

    Hi,
    Thanks, I didn't know what OTB means.
    I do not know how this OTB is maintained in the system (is it development?) but I assume it should be stored in a data table (data tables). If it is so, I think you should be able to extract it (this data) via the ABAP code in the mentioned user exit - but this is just my opinion, it's better you ask your ABAPer to check it in a sandbox system.
    Regards,
    Csaba
    Edited by: Csaba Szommer on Jun 23, 2010 9:23 PM

  • Determining the actual length of a string based on pixels?

    How would you determine the actual length of a string based on pixels? Reason for is because a length of a string containing all " l " chars would be a lot smaller then the length of a string containing all "H" chars based on pixel width.
    thanks,
    newbie

    Yes, look at the FontMetrics class which has methods to do just that. To get a relevant FontMetrics object, try "x.getFontMetrics(f)" where x is a Component and f is the Font your string is represented in.

  • I need to sort an array of strings based on the number in each string.

    Basically, I have a directory of files that all have the same name but each with a different number on the end.
    example: image 1.jpg, image 2.jpg, etc.
    When I use the List Directory function that returns an array of strings containing the file names in the directory, they don't come out in a 1, 2, 3, order like they appear in the directory. It sorts them character by character so that they come out like: 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 20, 21, 22 etc.
    Is there a simple way of sorting this array of strings with the file names (as above) so that they are in numerical order?

    It's a while since this thread was started, but I am sure others will have use for this so here goes:
    The in-built array sort function sorts the strings the same way DOS and Windows do. Microsoft has fixed this in the Explorer that comes with XP, however the rest of the OS(s) still sorts the old way.
    The attached "AlphaLogical String Array Sort" VIs will sort strings arrays the same way as the new XP Explorer. There are three different implementations of the sorting, one based on the Insertion sort algorithm, a Quick Sort based on recursive calls (the most elegant way, but unfortunately LabVIEW has too much overhead when doing recursive calls so this is actually a very slow alternative) and finally the fastest; a stack based Quick Sort. There is also a test VI that will show you how the different implementations perform.
    I had not used recursive calls in LV much until I made the attached quick sort and was a bit disappointed by the fact that it is so slow, but it's a good learning example...The ability to do recursive calls this way was introduced in LV7 I believe...There is an example here on the zone that shows how you can calulate a factorial by using recursive calls, however - unlike for the quick sort (normally) - recursive calls are actually not the optimal solution for that calculation.
    Message Edited by Mads on 09-13-2005 02:30 AM
    MTO
    Attachments:
    AlphaLogical Sorting.zip ‏142 KB

  • Selecting records based on user formula

    Post Author: Josh@RTA
    CA Forum: Formula
    I'm writing reports for a company that stores all of their dates as 8 digit numerical fields rather than a date or datetime datatype. I want to convert this field to a date type, then compare it to a parameter that stores user input as a date type.
    However, due to the way that Crystal does it's passes over the data, I can't use a selection formula based off of another formula. So I'm wondering , has anyone ever used a selection formula that references another formula and how have you been able to do it? Maybe use group selection instead of record selection? Just not sure.
    I'm including the formula I'm using to convert the date, as well as the selection formula so you get an Idea of what I'm doing.
    //This converts the numeric 'date' field to a dateshared stringvar DateString := totext({wotrans.ROP_TRAN_DATE}, 0, '');shared datevar ConvertedDate :=If {wotrans.ROP_TRAN_DATE} < 19590101 then Date (1959, 01, 01) else Date ( Val (DateString &#91;1 to 4&#93;),            Val (DateString &#91;5 to 6&#93;),            Val (DateString &#91;7 to 8&#93;) );
    //This is the select statement I'm using to compare the above formula to my parameter using record selection{@ConvertedTransDate} = {?TransDateRange}

    Post Author: SKodidine
    CA Forum: Formula
    Replace your formula with this and then equate it to your parameter value in your selection criteria and see if it will work.
    If {wotrans.ROP_TRAN_DATE} <= 19590101 then Date (1959, 01, 01)
    else
    date(
    tonumber(totext({wotrans.ROP_TRAN_DATE},0,'','')&#91;1 to 4&#93;),
    tonumber(totext({wotrans.ROP_TRAN_DATE},0,'','')&#91;5 to 6&#93;),
    tonumber(totext({wotrans.ROP_TRAN_DATE},0,'','')&#91;7 to 8&#93;));
    The process might be faster if you convert or change the data type of your parameter to numeric and then compare to the numeric date.

  • How to group rows based on a formula value

    Hi experts,
    I have a query that returns a a char row (country) and a couple of columns, "Duration of Process in days" and "Counter of nº process done", each a calculated formula KF .
    What I would like is to group the results based on formula KF1 results ""Duration of Process in days".
    For example: from this query result
    Country  -   Duration of Process in Days  -   Counter of nº process done
    ES                      1                                         3
    PT                      3                                         2
    UK                      4                                         3
    IT                       1                                          5
    US                      6                                         2
    FR                      1                                         3
    DE                      4                                         5
    get the following: aggregated by all possible formula values "Duration of Process in Days"
    Duration of Process in Days  -   Counter of nª process
                    1                                       11   (353)
                    3                                         2
                    4                                         8    (3+5)
                    6                                         2
    Is this possible??
    Thanks in advance for your help,
    Best regards,
    Enric

    Hi Vikram,
    my problem is that the "Duration in days" cannot be a characteristic derived in the loading process, as its value depends (is calculated) based on several user's selections done in the variable pop-up screen when executing the report.
    Thanks again for your reply.
    Enric

  • Oracle Spatial function to find nearest line string based on lat/long

    Hi,
    Here is my scenario. I have a table that contains geometries of type line strings (the roadway network). The line geomteries are of type Ohio state plane south (SRID 41104).
    I have a requirement - given a lat/long, find the line string that snaps to that lat/long or the nearest set of line strings within a distance of 0.02 miles.
    This is a typical example of trying to identify a crash location on our roadway network. The crashes being reported to us in lat/long thru the GPS system.
    How can i acheive this through any spatial functions?
    Thanks for the help in advance.
    thanx,
    L.

    Hi L,
    That is not the way I would do it. I would convert my road segments to LRS data, then you can do all queries on the same data.
    Or, if you do not want to modify your original data, create a copy of your road segments with the same ID's and convert the copy into LRS data. If you keep the ID's identical, you can easily use geometry from one and LRS data from the other - as long as you are sure the ID is the same.
    Which will make the workflow a bit easier:
    1. Use SDO_NN to get the closest segments
    2. Use SDO_LRS.PROJECT_PT to get the projected point
    3. Use SDO_LRS.GET_MEASURE to get the measure
    And most of these you can incorporate into one single query. Now I am writing this of the top of my head (It's been a while since I played with LRS). so this has not been tested, but something like this should work (but could probably be greatly improved - it's getting late for me :-) ):
    SELECT
    SDO_LRS.FIND_MEASURE  --//find_measure needs an LRS segment and a point
        SELECT            --//here we select the LRS segment
          r.geometry 
        FROM
          roadsegments r
        WHERE SDO_NN(r.geometry,    --//based on the given GPS point
                     sdo_geometry(2001, 41104, sdo_point_type(lat,lon,NULL), NULL, NULL), 
                     'sdo_num_res=2 distance=0.02 unit=mile') = 'TRUE'
      SDO_LRS.PROJECT_PT  --//We project the point on the LRS segment
          SELECT         --//here we select the LRS segment (again, which could probably be improved!!)
            r.geometry 
          FROM
            roadsegments r
          WHERE SDO_NN(r.geometry,
                       sdo_geometry(2001, 41104, sdo_point_type(lat,lon,NULL), NULL, NULL), 
                       'sdo_num_res=2 distance=0.02 unit=mile') = 'TRUE'
        sdo_geometry(2001, 41104, sdo_point_type(lat,lon,NULL), NULL, NULL) --//The GPS point again
    AS milemarker from dual;So it is not as complicated as you think, it can easily be done with just one query (SQL can do a lot more than you think ;-) ).
    Good luck,
    Stefan

  • Parse string based on pattern

    I'm trying to make a small prog that extracts a song's artist from its filename based on a specified pattern.
    Something like this:
    public String getArtist(String filename, string pattern) {
    String artist = getArtist("The artist - the title.mp3", "artist - title");
    artist = getArtist("01 - Another title - Another artist.mp3", "track - title - artist");Any good ideas on how to implement getArtist would be appreciated... :)

    heres my idea of how to solve it...
    this solution is not complete, but you may perfect it any way you like... it's just a quick and dirty hack ;)
    import java.util.regex.*;
    public class ArtistProblem {
    public static void main(String[] args) {
      if (args.length == 2) {
       System.out.println(getArtist(args[0], args[1]));
      } else {
       System.out.println(getArtist("The artist - the title.mp3", "artist - title"));
       System.out.println(getArtist("01 - Another title - Another artist.mp3", "track - title - artist"));
    public static String getArtist(String filename, String pattern) {
      // change track to regex that matces any spaces nad word characters
      pattern = pattern.replaceAll("track", "[\\\\w ]*");
      // change title to regex that matces any spaces nad word characters
      pattern = pattern.replaceAll("title", "[\\\\w ]*");
      // remove extention from the end of filename
      filename = filename.replaceAll("\\.mp3$", "");
      // change artist to regex that groups matched pattern
      pattern = pattern.replaceAll("artist", "([\\\\w ]*)");
      Pattern patt = Pattern.compile(pattern);
      Matcher matcher = patt.matcher(filename);
      if (matcher.find()) {
       return matcher.group(1);
      } else {
       // no match was found, so we return empty string
       return "";
    }try running it so:
    java ArtistProblem "the artist - the track - the title.mp3" "artist - track - title"
    and you'll get:
    the artist
    i hope that gives you a jumpstart to some direction.

  • Conditional formating based on excel formula

    Hi experts!
    I have a problem with BPC formatting. Under my EVDRE expansion, I inserted a column to validate some data before sending it. The value of this formula can be TRUE or FALSE and it validates each row of the expansion.
    Now, if the value is false, the row or at least some fields of it must turn red so the user knows were are the mistakes.
    I have defined under the format range an entry for the heading to evaluate in rows and in format I create the next conditional formatting:: =$I38 = FALSE ---> background red.
    When I push the refresh button, the format applies to al heading under the expansion, but the conditional format formula changes to =$I1064034 = FALSE
    If I lock the row number, it won't iterate for each row and the format will be based just on one cell instead of one cell per row.
    ¿Any ideas? ¿Other ways to achieve this? I've also tried to format the cell inside the expand and eliminate the entry on the format range but it doesn't expand to the rest of the cells...
    Thanks in advance

    Hi Nilanjan!
    Thanks for the answer, the individual conditional formatting is working fine!
    The reason why it wasn't working the first time was because it's incompatible to do individual conditional formatting with conditional formatting on format range.
    I gues I'll have to do all the formatting on individual cells...
    Thanks agains!

  • How to split string based on either space or tab delimitation?

    I'm trying to split a string into 4 fields.  The strings sometimes have space delimitation and sometimes have tab delimitation.  Is there any way to do this in a SELECT, or do I need a couple staging tables, or what?
    I'm trying to work with this.
    Select PARSENAME(replace(replace(replace(replace([Column 0],' ','<>'),'><',''),'char(9)',' '),' ','.'),4) Date,
    PARSENAME(replace(replace(replace(replace([Column 0],' ','<>'),'><',''),'char(9)',' '),' ','.'),3) ID,
    PARSENAME(replace(replace(replace(replace([Column 0],' ','<>'),'><',''),'char(9)',' '),' ','.'),2) Rank1,
    PARSENAME(replace(replace(replace(replace([Column 0],' ','<>'),'><',''),'char(9)',' '),' ','.'),1) Rank2
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    This is similar thread that someone posted a week ago
    Split delimited string into separate columns
    based on space
    My solution was, using a user defined function to split the text:
    Use Master
    Go
    CREATE FUNCTION dbo.udf_SplitString(@InputVal VARCHAR(200), @Delimiter CHAR(1))
    RETURNS @Items TABLE (RowNo TINYINT, ITEM VARCHAR(100))
    As
    BEGIN
    DECLARE @FieldLen TINYINT = 0, @FieldEnum TINYINT = 0, @TempItem VARCHAR(100) = '', @ItemLoop TINYINT = 1
    SET @FieldLen = LEN(@InputVal)
    WHILE @FieldEnum <= @FieldLen
    BEGIN
    IF (SUBSTRING(@InputVal, @FieldEnum + 1, 1) = @Delimiter OR @FieldEnum = @FieldLen) AND @TempItem <> ''
    BEGIN
    INSERT @Items (RowNo, Item)
    VALUES (@ItemLoop, LTRIM(RTRIM(@TempItem)))
    SET @TempItem = ''
    SET @ItemLoop += 1
    END
    ELSE
    BEGIN
    IF SUBSTRING(@InputVal, @FieldEnum + 1, 1) <> @Delimiter
    BEGIN
    SET @TempItem = @TempItem + SUBSTRING(@InputVal, @FieldEnum + 1, 1)
    END
    END
    SET @FieldEnum += 1
    END
    RETURN
    END
    Next, use the splited data to group based on requirements
    DECLARE @AllData TABLE
    [Column 0] VARCHAR(50)
    INSERT INTO @AllData
    VALUES('20150101 04559690 45 33')
    INSERT INTO @AllData
    VALUES('20150101 045595320 42 48')
    INSERT INTO @AllData
    VALUES('20150101 041198690 44 34')
    INSERT INTO @AllData
    VALUES('20150101 0455222130 41 49')
    INSERT INTO @AllData
    VALUES('20150101 554567450 40 51')
    ;WITH CTE
    AS
    SELECT
    ,Row_Number() OVER(PARTITION BY MainQry.[Column 0] ORDER BY MainQry.[Column 0]) As RowNo
    FROM
    @AllData As mainQry
    CROSS APPLY (SELECT Item FROM Master.dbo.udf_SplitString(REPLACE(MainQry.[Column 0], CHAR(9), ' '), ' ')) As SubQry
    SELECT
    [Column 0]
    ,MAX(CASE WHEN RowNo = 1 THEN Item ELSE '' END) AS [DATE]
    ,MAX(CASE WHEN RowNo = 2 THEN Item ELSE '' END) AS [ID]
    ,MAX(CASE WHEN RowNo = 3 THEN Item ELSE '' END) AS [Rank1]
    ,MAX(CASE WHEN RowNo = 4 THEN Item ELSE '' END) AS [Rank2]
    FROM
    CTE
    GROUP BY
    [Column 0]
    Output
    Column 0 | DATE
    | ID
    | Rank1 | Rank2
    20150101 0455222130
    41 49
    | 20150101
    | 0455222130
    | 41 | 49
    20150101 554567450
    40 51
    | 20150101
    | 554567450
    | 40 | 51
    20150101 041198690 44  34
    | 20150101
    | 041198690
    | 44 | 34
    20150101 045595320 42   48
    | 20150101
    | 045595320
    | 42 | 48
    20150101 04559690 45  33
    | 20150101
    | 04559690 | 45
    | 33
    Best Wishes, Arbi; Please vote if you find this posting was helpful or Mark it as answered.

Maybe you are looking for

  • IPhoto Time/Date Change problem

    There is one particular event in my iPhoto program that registered the wrong date when downloaded.  In trying to change it, the program automatically sets the date about 130 years earlier, regardless of what date I type in.  It only happens with this

  • Insert links in jeditorpane

    Hi, I am working on an applet that allow a user to edit simple HTML. The user can basicly enter plain text, and there are buttons that bold and add links. I have also made Enter insert a break tag. The code works fine EXCEPT in one case. If a user pa

  • How do I remove the old Adobe Updater?

    I have two Adobe items in my menubar (see attached image). I'm now using CC, so I want to get rid of the older updater. How do I do that?

  • Errors while installing Mac OS X 10.4

    Hi, I am trying to upgrade my sisters computer from 10.3 to 10.4. I'm using upgrade CD's. The first disc worked fine, and it asked me to insert the second disc, so I did. Everything seems to be going fine but then it will say 'there were errors insta

  • Using Proxy on e71

    hello ive managed to connect my e71 to my linksys router @ home. i use the internet on my laptop wirelessly. the internet connects from my laptop and NOT on the router ! so ive tried using a proxy software (spoon) on my laptop and have tested with an