Plex 2E

Expand all | Collapse all

Meta For Each Row - skip selected rows

Jump to Best Answer

George Jeffcock02-17-2016 06:07 AM

George Jeffcock02-17-2016 06:47 AM

  • 1.  Meta For Each Row - skip selected rows

    Posted 02-17-2016 02:55 AM

    Is it possible to skip selected rows when going through a grid with meta loop? How to do it if it's possible?

     

    I tried:

     

    For Each Row  GridP

         +If Not Selected

     

    But action diagram did not accept that.



  • 2.  Re: Meta For Each Row - skip selected rows

    Posted 02-17-2016 03:08 AM

    no you cant but have used

    ReverseGridRowSelection

    before to process all NOT selected rows



  • 3.  Re: Meta For Each Row - skip selected rows

    Posted 02-17-2016 03:13 AM

    Okay, thanks for the information.



  • 4.  Re: Meta For Each Row - skip selected rows

    Posted 02-17-2016 03:28 AM

    will try and dig up the some source that tests if a row is selected which would be most helpful for you. It is possible as the runtime does it! The CA runtime has to abide to the same rules outlined in http://wiki.plexinfo.net/index.php?title=WinWidgets



  • 5.  Re: Meta For Each Row - skip selected rows

    Posted 02-17-2016 05:15 AM

    On the "Select Grid" event , store the selected grid values in a temp variable.(TempSelectedGridP). Have Key fields in the temp variable.

     

    For Each Row  GridP

      If GridP != TempSelectedGridP

              ... Do your process



  • 6.  Re: Meta For Each Row - skip selected rows

    Posted 02-17-2016 05:32 AM

    Only works if grid property Single Row Select is set to Yes.



  • 7.  Re: Meta For Each Row - skip selected rows

    Posted 02-17-2016 06:02 AM
    #define HGRM_ISSELECTED  (HGM_FIRST + 87)

    C:\Program Files (x86)\CA\Plex\6.1\include\WIDGETS.H

     

     

     

    *So you will do something like

     

    SelectRow, TurnOffRow, and TurnOnRow APIs

    Platform

    Windows C++

    Pattern Library SRC Objects

    WINAPI/SelectGridRow, WINAPI/DeselectGridRow, WINAPI/ReverseGridRowSelection

    Syntax Conventions

    HWND hwndGrid = ObPanelAPI::GetControlHandleByName (ControlName);
    SendMessage(hwndGrid, HGM_SELECTROW, RecordNumber,0);

    HWND hwndGrid = ObPanelAPI::GetControlHandleByName(ControlName);
    SendMessage(hwndGrid, HGM_TURNONROW, RecordNumber,0);

    HWND hwndGrid = ObPanelAPI::GetControlHandleByName(ControlName);
    SendMessage(hwndGrid, HGM_TURNOFFROW, RecordNumber,0);

    Parameter

    Meaning

    Field type

    Direction

    ControlName

    The name of the grid control, as specified by its Control Name property in the Panel Designer.

    Character

    Input

    RecordNumber

    The number of the row in the grid.

    Note: The first row is in the grid is 0 (not 1).

    Numeric

    Input

    Description

    Use these APIs to select and deselect rows on a Windows grid:

    The APIs support multiple selections, so selecting a row adds it to the existing set of selected rows. The grid scrolls to make the row visible before it is selected or deselected (if necessary). If you only require single selections note that you can use the Locate field statement for this purpose.

    Note that the record number of the first row in the grid is 0. Within a For Each Row loop you can increment a counter in order to determine the record number (see example). In other situations it is more difficult to determine the record number since it changes dynamically when, for example, individual rows are deleted from the grid.

    Note: These APIs do not work correctly if the Whole Row Selection property is set to No or if the Single Selection property is set to True. Avoid using these properties in conjunction with these APIs.

    Example

    The following code supports a Select All menu command on a typical OBASE grid. Note that this selects only those records that have been loaded into the grid (not necessarily all records in the associated database table). You can use the TurnOffRow and SelectRow APIs to create Deselect All and Invert Selections menu commands in the same way.

    Edit Point Additional Events
      Event
    Event: SelectAll
        Set
    Local<record number> = <record number.-1>
        For Each Row
    Grid
          Set
    Local<record number> = Local<record number> + <record number.1>
          API Call
    Source code: Select Row

    The source code for the API looks like this:

    HWND hwndGrid = ObPanelAPI::GetControlHandleByName("Grid");
    SendMessage(hwndGrid, HGM_TURNONROW, &(1:),0);

    In this example, the Control Name property of the grid control must be set to "Grid" (without the quotes).


    Copyright © 2008 CA. All rights reserved.



  • 8.  Re: Meta For Each Row - skip selected rows

    Posted 02-17-2016 06:07 AM

    Capture.PNG



  • 9.  Re: Meta For Each Row - skip selected rows

    Posted 02-17-2016 06:47 AM

    Yep it works

     

    Just tested in AutoIt - AutoIt

     

    Capture.PNG



  • 10.  Re: Meta For Each Row - skip selected rows

    Posted 02-17-2016 06:56 AM

    No this could work..have not tested the boolean test in this example but you get the idea.

    Capture.PNG

     

    Please mark as correct if you feel and get back to us on your findings as this has taken me time to do for you!



  • 11.  Re: Meta For Each Row - skip selected rows

    Posted 02-17-2016 07:27 AM

    Ok, thanks a lot for studying the problem!

     

    I'll bookmark this so Ill come back when I can look these when I need this functionality.



  • 12.  Re: Meta For Each Row - skip selected rows
    Best Answer

    Posted 02-17-2016 07:33 AM

    but this is what you asked for.

     

    For Each Row  GridP

         +If Not Selected

     

    You cant do this so you could do exactly this with this source

     

    int = 0

    For Each Row  GridP

    Int = int + 1

    Call Source

    If True

         Row is Selected

    Else

         Row is not Selected



  • 13.  Re: Meta For Each Row - skip selected rows

    Posted 02-17-2016 08:03 AM

    Yes, my original question was just if looping unselected rows would be possible with meta code. Now I know that it isn't possible using only meta code, but a api function is also needed. I think it would not hurt if that condition could also be implemented in meta loop.

     

    Thanks again for your help.



  • 14.  Re: Meta For Each Row - skip selected rows

    Posted 02-17-2016 08:27 AM

    Meta-Loop: A type of action diagram meta-operation that causes the generator to iterate through instances of certain objects. The objects concerned are determined by the type of meta-loop. For example, the +For Each View meta-loop iterates through each object (field or attribute) belonging to a specified view.

     

    Looping using meta code is only during generation time.

     

    Any action diagram statement that does not contain a prefix of "+" is normal A/D.

     

    There are things that normal A/D can do and use of meta code is for largely for creating abstract solutions.

     

    You cannot loop thru Grid rows using meta code.



  • 15.  Re: Meta For Each Row - skip selected rows

    Posted 02-17-2016 09:34 AM

    Thanks for clarifying that. I really have made a mistake in this thread, talking about meta loops when the loop used is actually a normal action diagram loop.