Hide a field value based on the value of the previous row

I need to read the string before the underscore (_) and show that the value in the 1st row for the field of Value1. For example, if the previous string (ABCDE) is equal to that of the second line I need to hide the value (100) on the field of the value1.

Sample data:

Report IDVal1Val2Val3
ABCDE_01100200300
ABCDE_02100250350
XYZ5006028

Final results:

Report IDValue1Value2Value3
ABCDE_01100200300
ABCDE_02250350
XYZ5006028

I am using code below but error.

<? If: xdoxslt:get_variable($_XDOCTX,_'x')! = substr (REPORT_ID, 0, instr(REPORT_ID, '_', 0) - 1)? >

<? Value1? >

<? end if? >

<? xdoxslt:set_variable ($_XDOCTX, 'x', substr (REPORT_ID, 0, (instr(REPORT_ID, '_', 0)-1)))? >

You can use this condition instead:

It will manage both of your cases.

Tags: Business Intelligence

Similar Questions

  • Table expanding: calculation of the difference in the value of the previous row

    Hello

    I'm a complete newbie to LiveCycle Designer (ES2) and created under the document with a table in full expansion.

    Shared files - Acrobat.com

    My goal is to make the friendly form by adding a calculation in the field "Twist" that calculates the difference of the current line to the previous row.

    I have no idea about Java Script, I'm afraid and also do not know if this is possible at all, so it's probably a bad idea after all.

    The reason for setting up as a table expansion is so that the form can be used for all 32 instances form would be used for (they all need different number of rows in total).

    The calculation will start in row 2 (Checklist.Table1), take the value of the entry in row 2 torsion and calculate the difference in the value of the twist entry in row 1.

    Then, in row 3, it calculates the difference between the value of the twist in the row 3 tier 2, etc.

    So subtract the value of the field in then with the value line onlinen-1 or something in that sense.

    Is there anyone at all who could help me with that at all?

    I would be very grateful for any advice you could give me.

    Thank you very much!

    Mathilda

    Hi Matilda,.

    Try this code;

    if (Row1.index > 0 && !Row1.resolveNode("NumericField4[0]").isNull)
    
     var prevTwist = Table1.resolveNode("Row1[" + (Row1.index - 1) + "].NumericField4[0]").rawValue
    
     var result = Math.abs(3000 / (Row1.resolveNode("NumericField4[0]").rawValue - prevTwist));
    
     this.rawValue = result;
    
     this.rawValue = "";
    

    Concerning

    Bruce

  • By subtracting the previous row less the current line in SQL

    I have a table - orders.

    How to subtract the previous row less line current for incoming column

    enter image description here

    If anyone can help.

    Hello

    It is not clear what you want. What is the previous row? What order to examine DATE_IN?

    Here is an example of using the function DATE_IN LAG to retrieve the previous value of the line consider the sort column.

    WITH commands LIKE (select to_date (27 May 2015 ', ' dd/mm/yyyy') date_in, 83 of the double incoming_vol)

    Union of all the

    Select to_date (May 26, 2015 ', ' dd/mm/yyyy') date_in, 107 double incoming_vol

    Union of all the

    Select to_date (May 25, 2015 ', ' dd/mm/yyyy') date_in, 20 incoming_vol of the double

    Union of all the

    Select to_date (May 24, 2015 ', ' dd/mm/yyyy') date_in, 7 incoming_vol of the double

    Union of all the

    Select to_date (May 22, 2015 ', ' dd/mm/yyyy') date_in, 71 double incoming_vol

    )

    SELECT date_in

    incoming_vol,

    NVL (lag (incoming_vol) (date_in release order), 0)-incoming_vol previous_row_minus_current_row

    Orders

    ORDER BY 1 desc;

    DATE_IN INCOMING_VOL PREVIOUS_ROW_MINUS_CURRENT_ROW

    ----------- ------------ ------------------------------

    27/05/2015 83 24

    26/05/2015-107-87

    25/05/2015-20-13

    24/05/2015             7                             64

    22/05/2015-71-71

    If this isn't what you want then please give the expected results.

  • Sum of the values of the previous rows in a PivotTable

    Hello

    I have a dynamic table has several lines (dynamically added via a button).  A column in the table is a quantity column.  Another is a Total of the column.  We do not keep a cumulative, but wants to only display an total when the rest of the cells in the same row are emty and the previous lines has / have values in the quantity column.  The Total is the sum on the Quatnities until a blank line.  Here is a sample.  How can I get the value of the quantities in the previous lines?

    Quantity Total


    5
    8
    12

    25


    7
    27

    34


    22

    22


    Another option could be to put the Total in the last row with data as opposed to the line below the data.

    Any ideas?

    Kind regards

    Karl

    The script is written to achieve your requirement (i.e. the second approach you mentioned)

    .

    You can either contact me at [email protected] for the example of created form.

    Or what follows is the Source XML of the form. Copy all the content in your form XML source mode and see the result.

    http://ns.Adobe.com/XDP/"timeStamp =" "2012-02 - 28 T 14: 04:54Z ' uuid ="2c561cdf-3377-4e84-9a89-51e740bb2fea">"

    Adding line

    Quantity

    Total

    user interface

    >

    character = "Myriad Pro

    "/>

    margin = topInset ' 1 mm ' bottomInset = ' 1 mm ' leftInset = ' 1 mm ' rightInset = ' 1 mm»

    "/>

    para vAlign = "middle".

    "/>

    border

    >

    edge

    />

    angle thickness = "0,1778 mm

    "/>

    border

    >

    field

    >

    = "Total" field name "44.47 mm" h = w = "9,317 mm" access = "readOnly".

    ">

    user interface

    >

    numericEdit

    >

    presence at the border = "hidden".

    ">

    border

    >

    the margin of

    />

    numericEdit

    >

    user interface

    >

    character = "Myriad Pro

    "/>

    margin = topInset ' 1 mm ' bottomInset = ' 1 mm ' leftInset = ' 1 mm ' rightInset = ' 1 mm»

    "/>

    this.rawValue = null; Clear the total value

    }

    } catch (e)

    {

    app.alert (e)

    }

    9.0.0.0.20091029.1.612548.606130

    http://www.XFA.org/schema/XCI/2.8/">

    PDF

    1.7

    3

    *

    http://www.XFA.org/schema/XFA-locale-set/2.7/">

    January

    February

    March

    April

    May

    June

    July

    August

    September

    October

    November

    December

    Jan

    Feb

    Mar

    Apr

    May

    Jun

    Jul

    Aug

    Ms

    Oct

    Nov

    Dec

    Sunday

    Monday

    Tuesday

    Wednesday

    Thursday

    Friday

    Saturday

    Sun

    LUN

    Mar

    Fri

    Game

    Fri

    Sam

    AM

    PM

    BRITISH COLUMBIA

    AD

    EEEE, MMMM D, YYYY

    MMMM D, YYYY

    MMM D, YYYY

    M/D/YY

    SS Z

    SS Z

    SS HAS

    h: mm A

    GyMdkHmsSEDFwWahKzZ

    z, zz9.zzz

    $z, zz9.99 | ($z, zz9.99)

    z, zz9%

    .

    ,

    %

    -

    0

    $

    USD

    .

    "RDF: RDF xmlns:rdf ="http://www.w3.org/1999/02/22-rdf-syntax-ns#

    ">

    "RDF: description xmlns:xmp ="http://ns.adobe.com/xap/1.0/"rdf: subject"

    ="">

    XMP:MetadataDate > 2012-02-28 T 14: 04:54Z

    >

    XMP:CreatorTool > Adobe LiveCycle Designer ARE 9.0

    >

    RDF: description

    >

    "RDF: description = xmlns:pdf"http://ns.adobe.com/pdf/1.3/"rdf: subject"

    ="">

    PDF:producer > Adobe LiveCycle Designer ARE 9.0

    >

    RDF: description

    >

    "RDF: description = xmlns:xmpMM"http://ns.adobe.com/xap/1.0/mm/"rdf: subject"

    ="">

    xmpMM:DocumentID > uuid:2c561cdf-3377-4e84-9a89-51e740bb2fea

    >

    RDF: description

    >

    "RDF: description = xmlns:desc"http://ns.adobe.com/xfa/promoted-desc/"rdf: subject"

    ="">

    DESC:version rdf:parseType = "resource".

    ">

    RDF: value > 9.0.0.0.20091029.1.612548.606130

    >

    DESC:REF > / template/subform [1]

    >

    DESC:version

    >

    RDF: description

    >

    RDF: RDF

    >

    x: xmpmeta >

  • How to assign the field width based on the screen wdth

    I have my ownfield, I'm adding to the screen, or the Manager

    I want to give the height and the width of field based on the width of Manager screen, when I try I got errors.

    the code I used is

    Field ff;
            int j=(Display.getWidth()>360?4:3);
            int compwid=Display.getWidth()/j;
            int compht=40;
            int posx=0,posy=0;
            int no=this.getFieldCount();
    
            for(int i=0;i
    

    When I do cela in the display main () sublayout, I get the error as "the field is not a child of this Manager.

    Similarly when I add to the Manager sublayout, I get as field must call setExtent and setPostion for available.

    Where I'm going wrong?

    You can help with that.

    Concerning

    Rakesh Shankar.P

    Hi guys, I was able to get this working, pblm is that I called super.sublayout () just before the Codes I have describd in the previous post.

    Concerning

    Rakesh Shankar.P

  • Hide a metadata profile based on the user role.

    Hi all

    I need to hide a metadata profile (log, update) based on the user role page. I have added metadata to a rule like "change" and added the rule to the profile. Now I want the metadata submitted must be visible for couple of user roles (admin, contributor) and it should be hidden for other user roles. How to achieve this?

    The content Server: 11.1.1.8

    Thank you

    Maury

    (1) create a rule that allows you to hide the metadata for all roles

    (2) create a new one which will show use the condition of activation of rule with building userHasRole("contributor")

  • How to connect, based on the previous user name connection?

    I have 2 usernames in Windows 7 family?

    User 1) NY

    User 2) Tokyo

    I connect using NY username and logout, then login using the username of Tokyo and reboot window 7 Home, it connections using NY instead of the previous Tokyo connection.

    Anyone have any suggestions on how to set the default connection based on a previous connection in Windows 7 Home?

    Thanks in advance for your suggestions

    I don't think that this option exists in Windows 7.

  • How to get the sum of the first row in the previous row?

    Dear gurus... I need to get the sum of a column of the first row of my result set to the previous line based on a condition. I read analytical functions for this but they provide the sum of the first rank to Current Row through declaration "rows between Unbounded preceding and current line. Y at - it a statement that calculates the sum as "rows between Unbounded preceding and previous row?

    Hello

    kamranpathan wrote:
    Dear gurus... I need to get the sum of a column of the first row of my result set to the previous line based on a condition. I read analytical functions for this but they provide the sum of the first rank to Current Row through declaration "rows between Unbounded preceding and current line.

    If you do not explicitly give a windowing clause, then you get the default windowing clause you indicated.
    If you want another clause of windowing, ionclude in the analytic function call.

    Y at - it a statement that calculates the sum as "rows between Unbounded preceding and previous row?

    Yes. The correct syntax for "Previous rank" is «PREVIOUS 1»

    ...  ROWS BETWEEN  UNBOUNDED PRECEDING
                AND        1          PRECEDING
    

    For more information, search for "Analytic Functions" in the manual of the SQL language:
    http://download.Oracle.com/docs/CD/E11882_01/server.112/e17118/functions004.htm#sthref917

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all tables and also post the results desired from these data.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.
    You will find the answers better faster if you always provide this information whenever you post a question.

    Published by: Frank Kulash, Sep 17, 2011 17:04
    I just saw Etbin responses.
    As usual, Etbin has a good point. If the column that you are basically cannot be NULL, then it is probably easier to subtract the total current line and use the default windowing clause.
    Even if it can be null, you find may be easier to use this approach.

  • hide/show the metadata on consignment form based on the previous value of metadata

    Hi all

    I HV a use case where while logging users hv to select yes/no value of my custom metadata.
    based on this input i hv to show/hide the following metadata field.

    How to get there, using profile, I think not that this is possible.
    Help, please.
    Thank you
    -Yves

    what I want to know can trigger us some other profile with the other trigger condition (other than the trigger of object type web site).

    By definition, there is only one field of trigger for profiles.

    On the other hand, each profile consists of rules and rules may have conditions of activation of the so-called rules (http://docs.oracle.com/cd/E23943_01/doc.1111/e10978/c04_metadata.htm#DAFGJDIF) that may contain a simple idocScript which may contain a different number of metadata and/or other controls.

    Therefore, you can have a profile, but for example to show different areas of research/Check-in, etc.

    the second question was site studio Contributor mode - when we create a new CDF file, use a switch content on all time placeholder first consignment form comes how to apply a profile he

    There is a single mounting global admin Administration - Administration of Site Studio - the default Web assets Document information, where you can predefine the value of the profile (the one mentioned above) trigger field. The obvious disadvantage, which is OK for the majority of cases, is that you will have a profile for all of your sites. If you want to have a finer distinction, you will need to use the conditions of activation of rules (for example to separate between the sites you could use <$siteId$>in your terms).

  • Dynamic action in Apex - automatic text field display based on the definition of value

    Hello

    I have two text elements. Need to create dynamic action for what follows,

    1 Order_number

    2 Order_type

    When a user enters an order number starting at 1, the order type should type should automatically posted as CONSUMER.


    When a user enters an order number starting with 2, the order type should type should be automatically displayed as COMPANY to another display null.

    Can anyone help please have solved this issue.

    Thanks in advance!

    Hi 2932464,

    2932464 wrote:

    Please change your login username of "2932464" to something meaningful. Reference: Video tutorial how to change username available

    I have two text elements. Need to create dynamic action for what follows,

    1 Order_number

    2 Order_type

    When a user enters an order number starting at 1, the order type should type should automatically posted as CONSUMER.

    When a user enters an order number starting with 2, the order type should type should be automatically displayed as COMPANY to another display null.

    Can anyone help please have solved this issue.

    Hereby you mean something like this: https://apex.oracle.com/pls/apex/f?p=52380:11:129938442406997:

    If Yes, then create dynamic action as follows:

    • Create a dynamic action on the Order_number change event say. P11_ORDER_NUMBER.
    • Event-> change, Type of selection-> item (s), article (s)--> P11_ORDER_NUMBER Condition-> is not null
    • Real Action-> to run the JavaScript Code
    • JavaScript code:
      var ordernum = $('#P11_ORDER_NUMBER').val();
      var startdigit = ordernum.substr(0,1);
      if (parseInt(startdigit) === 1) {
        $('#P11_ORDER_TYPE').val('CONSUMER');
      } else if (parseInt(startdigit) === 2) {
        $('#P11_ORDER_TYPE').val('BUSINESS');
      }
    

    I hope this helps!

    Kind regards

    Kiran

  • Need help to make the field required, based on the drop-down menu ' YES/NO' other please field

    field 'A' - drop down, YES/No.  Field 'B' must be entered if 'A' = 'YES '.  If 'A' = 'NO', then 'B' as a default of 0. If "A" = "-", then "B" is "-".

    Really, I hope someone can help, Ive tried java, etc. action buttons.

    Thank you

    To set the property of the EmployeeID field B use the following that the validation of your menu script drop-down:

    this.getField("B").required = (event.value == "YES");

    As noticed TSN, the required field only comes into play when the record is submitted (and only when it is done using the built-in command to submit, do not use a script).

    However, it is possible to use a script to inform him that the use that the file is not correctly filled in when the file is printed/saved and even to reset the form entirely in this case.

  • Need help to write the query to extract the value of the previous row - Lag not help


    Hello

    I created follwing table.

    Create table test

    (number of fi,

    number of fo_fv

    number of jup_fv

    action varchar2 (10)

    );

    insert into TEST(1,1,1,'LOAD');

    Insert into TEST (2, NULL, 2, "ROLL");

    insert into TEST(3,,3,'ROLL');

    insert into TEST(4,,4,ROLL);

    insert into TEST (5,2,5,LOAD);

    I want the result of the query as below:

    FI FO_FV JUP_FV ACTION

    -------------------------------------------------------------------

    1          1                    1                    LOAD

    2          1                    2                    ROLL

    3          1                    3                    ROLL

    4          1                    4                    ROLL

    5          2                    5                    LOAD

    Help, please.

    Thank you!

    SQL > select fi
    2, max (fo_fv) on fo_fv (fi control)
    3, jup_fv
    4, action
    5 of the test;

    FI FO_FV JUP_FV ACTION
    ---------- ---------- ---------- ----------
    1 1 1 LOAD
    ROLL OF 2 1 2
    3 1 3 ROLL
    4 1 4 ROLL
    5 2 5 LOAD

    OR

    SQL > select *.
    2 test
    model 3
    Dimension 4 by (fi)
    5 measures (fo_fv, jup_fv, action)
    6 rules
    7   (
    8 fo_fv [any] = case when fo_fv [cv ()] is null
    9. can fo_fv [cv () - 1]
    10 fo_fv [cv () else]
    11 end
    (12);

    FI FO_FV JUP_FV ACTION
    ---------- ---------- ---------- ----------
    1 1 1 LOAD
    ROLL OF 2 1 2
    3 1 3 ROLL
    4 1 4 ROLL
    5 2 5 LOAD

  • obtaining the previous value of the previous row

    Hello

    My desired output should be

    ID Book_date credit Previous_Credit
    123IT1 08/12/2008 100800 72500


    in this table:

    ID book credit date
    123IT1 08/12/2008 100800
    123IT1 12/18/2007 72500
    123IT1 14/11/2006 150720

    I tried to use the function of leader, but I have a problem when I included the condtion Beach date:

    This is my query:

    SELECT id, book_date, lead (credit), credit (any order of rownum) as previous_credit
    t
    "where book_date between 1 December 2008 and 31 December 2008"

    Result

    ID Book_date credit Previous_Credit
    123IT1 08/12/2008 100800
    The previous_credit column is always empty. I think because of the date range... ?

    No idea how to get the right result? pls help
    with t as ( -- generating sample data
    select '123IT1' id, to_date('12/8/2008', 'mm/dd/yyyy') book_date, 100800 credit from dual union
    select '123IT1', to_date('12/18/2007', 'mm/dd/yyyy'), 72500 from dual union
    select '123IT1', to_date('11/14/2006', 'mm/dd/yyyy'), 150720 from dual
    )
    --
    -- actual query
    --
    select *
    from ( select id
           ,      book_date
           ,      credit
           ,      lag(credit) over (partition by id order by book_date) as previous_credit
           from   t
         )
    where  book_date between to_date('12/01/2008', 'mm/dd/yyyy') and to_date('12/31/2008', 'mm/dd/yyyy')
    
  • How to hide a link/article based on the condition

    Hi all

    I have three sections in my dashboard page; section two contains guest user has run before. The third section contains a link to run the report. I need hidden link, run the report that users fill out invites him and press the Go button. How can I achieve this?

    Well, here are a few tips to navigate in this forum...

    (1) If a person offers a suggestion, answer like "Yes, it worked" or "no, it didn't work," then explain how it did not work if possible (you have an error message?, unexpected results, etc.)

    (2) even if a solution maybe not exact, if you helped to give you a new insight or if someone has taken the time to develop a response that helps you understand your problem beter, you can and should provide "useful" points

    (3) if the answer solves your problem or validates what you thought, you can mark it as "correct" and recognize providers of solutions and advice. ("Thank you guys for your help," etc.)

    (4) finally close the message itself.

    This would encourage others to help you in the future when you ask your question. (It is possible to "Watch" a user and never answer their question once again, if the poster is rude or ungrateful.)

    My final advice is Kishore is among the largest AIDS in this forum, my recommendation would be not not to the flame of his comments (even slightly) because it is he who will decide whether he will help you again. Oh, and Kishore hosts this forum. With many others in this forum, there just provides solutions and tips, devoting his time and resources when he can. :)

    I hope this helps.

  • date of breach varies at continuous intervals and ending date of the previous row

    Hello
    can someone give me an idea for situation below

    I have a table with records
    CREATE  TABLE test1
      (
        key VARCHAR2(11 BYTE) NOT NULL ENABLE,
       cd VARCHAR2(10 BYTE) NOT NULL ENABLE,
            start_dt DATE NOT NULL ENABLE,
        end_dt date,
        CONSTRAINT x1 PRIMARY KEY (key, cd, start_dt));
        
    Insert into test1 (key,cd,start_dt,end_dt) values ('1234','A',to_date('01-MAR-78 00:00:00','DD-MON-RR hh24:mi:ss'),to_date('31-DEC-99 00:00:00','DD-MON-RR hh24:mi:ss'));
    Insert into test1 (key,cd,start_dt,end_dt) values ('1234','B',to_date('01-MAR-78 00:00:00','DD-MON-RR hh24:mi:ss'),to_date('31-DEC-99 00:00:00','DD-MON-RR hh24:mi:ss'));
    Insert into test1 (key,cd,start_dt,end_dt) values ('1234','Q',to_date('01-JAN-89 00:00:00','DD-MON-RR hh24:mi:ss'),to_date('31-JAN-97 00:00:00','DD-MON-RR hh24:mi:ss'));
    Insert into test1 (key,cd,start_dt,end_dt) values ('1234','B',to_date('01-FEB-97 00:00:00','DD-MON-RR hh24:mi:ss'),to_date('30-APR-97 00:00:00','DD-MON-RR hh24:mi:ss'));
    insert into test1(key,cd,start_dt,end_dt) values ('1234','Q',to_date('01-FEB-97 00:00:00','DD-MON-RR hh24:mi:ss'),to_date('30-APR-97 00:00:00','DD-MON-RR hh24:mi:ss'));
    Insert into test1 (key,cd,start_dt,end_dt) values ('1234','B',to_date('01-MAY-97 00:00:00','DD-MON-RR hh24:mi:ss'),to_date('31-MAR-99 00:00:00','DD-MON-RR hh24:mi:ss'));
    commit;
    
    key     cd     start_dt                     END_DT
    1234     B     01-MAR-78 00:00:00     31-DEC-99 00:00:00
    1234     A     01-MAR-78 00:00:00     31-DEC-99 00:00:00
    1234     Q     01-JAN-89 00:00:00     31-JAN-97 00:00:00
    1234     Q     01-FEB-97 00:00:00     30-APR-97 00:00:00
    1234     B     01-FEB-97 00:00:00     30-APR-97 00:00:00
    1234     B     01-MAY-97 00:00:00     31-MAR-99 00:00:00
    I want to merge the range date lines that overlap, break at intervals and set the indicator (A_IND, B_IND, Q_IND) accordingly. (IE, if a record in the source has a value for the 'cd' = 'B' column in a given date range, then the output should display 'Y' for the B_IND column for the date ranges in the source folder.)
    I want also to the date of the end of each record to be 1 day less than the start_dt of the next record, as shown below.
    and the output should be
    key     start_dt                          END_DT     A_IND     B_IND     Q_IND
    1234     01-MAR-78 00:00:00     31-DEC-88 00:00:00     Y     Y     N
    1234     01-JAN-89 00:00:00     30-JAN-97 00:00:00     Y     Y     Y
    1234     31-JAN-97 00:00:00     31-JAN-97 00:00:00     Y     Y     N
    1234     01-FEB-97 00:00:00     29-APR-97 00:00:00     Y     Y     Y
    1234     30-APR-97 00:00:00     30-APR-97 00:00:00     Y     Y     N
    1234     01-MAY-97 00:00:00     30-MAR-99 00:00:00     Y     Y     N
    1234     31-MAR-99 00:00:00     31-DEC-99 00:00:00     Y     Y     N

    Hello

    user12997203 wrote:
    Hello
    can someone give me an idea for situation below

    I have a table with records

    CREATE  TABLE test1 ...
    

    Thanks for the display of the data of the sample; It is very useful.

    I want to merge the range date lines that overlap, break at intervals and set the indicator (A_IND, B_IND, Q_IND) accordingly. (IE, if a record in the source has a value for the 'cd' = 'B' column in a given date range, then the output should display 'Y' for the B_IND column for the date ranges in the source folder.)

    Do not assume that everyone who wants to help you is familiar with your application and your needs. Explain what key role plays in this problem. See {message identifier: = 10865697}.
    Here's one way:

    WITH     change_points       AS
    (
         SELECT     key
         ,     start_dt     AS dt
         FROM     test1
        UNION
         SELECT     key
         ,     end_dt          AS dt
         FROM     test1
    )
    ,     ranges          AS
    (
         SELECT  key
         ,     dt                    AS start_dt
         ,     LEAD (dt)     OVER ( PARTITION BY  key
                                        ORDER BY          dt
                           )          AS next_dt
         FROM     change_points
    )
    SELECT    r.key
    ,       r.start_dt
    ,       r.next_dt - CASE
                         WHEN  r.next_dt = MAX (r.next_dt) OVER ()
                    THEN  0
                    ELSE  1
                      END                         AS end_dt
    ,       MAX (CASE WHEN t.cd = 'A' THEN 'Y' ELSE 'N' END)     AS a_ind
    ,       MAX (CASE WHEN t.cd = 'B' THEN 'Y' ELSE 'N' END)     AS b_ind
    ,       MAX (CASE WHEN t.cd = 'Q' THEN 'Y' ELSE 'N' END)     AS q_ind
    FROM       ranges     r
    JOIN       test1          t  ON   t.key          = r.key
                        AND     t.start_dt     < r.next_dt
                      AND     t.end_dt     > r.start_dt
    GROUP BY  r.key
    ,            r.start_dt
    ,       r.next_dt
    ORDER BY  r.start_dt
    ;
    

    Note that this depends on the values that you want in the columns a_ind, b_ind and q_ind. For example, if you were doing this for users of German language, you might want to show 'J' and 'n' instead of 'Y' and 'n'. In this case, you would use MIN instead of MAX, to get the dominant value.

Maybe you are looking for