Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: DD_Commit and indexed fields

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Location
    Rio do Sul - SC
    Posts
    284

    Default DD_Commit and indexed fields

    Hi

    Why indexed fields with DD_Commit set to true can get the focus?

    We have a order entry view style with a child table where we use the commit feature. The main and child DD's has the IsCommitted function working as expected and when the record is committed all the fields are disabled (displayonly), except the indexed field of a child table placed in a cDbCJGrid.

    In File_Field_Committed_Options function from Datadict.pkg I got this
    Code:
            Get File_Field_Index iFile iField to iIndex
            Get IsCommitted of hoOwner iField to bIsCommitted
            If bIsCommitted Begin
                Get IsFieldCommitted of hoOwner iField to bIsCommitted
                If bIsCommitted Begin
                    // if committed, it is noput and, if non-indexed, also noenter
                    Move (If(iIndex=-1,DD_DISPLAYONLY,DD_NOPUT)) to iNewOpts
                End
            End
            // if a finding parent field, we want to know if you are allowed to switch parents as we will assume
            // that this field is used for finding.        
            If (hoOwner<>Self and iIndex>-1) Begin
                Get AllowParentFind of hoOwner to bIsCommitted
                If not bIsCommitted Begin
                   Move DD_DISPLAYONLY to iNewOpts
                End
            End
    I know the noput option is on, but when, under the same conditions, some fields are enterable and others not (and those enterable fields doesn't save its changes), end users get confused.

    As the server (hoOwner of the above code) of the cDbCJGrid cannot be changed (child table DDO), is there a way to change this behaviour and set the indexed fields to display only too?

    Thanks.
    []'s
    Clayton Schirmer

  2. #2
    Join Date
    Feb 2009
    Location
    New Prague, Minnesota USA
    Posts
    1,125

    Default Re: DD_Commit and indexed fields

    I believe indexed fields are set this way to allow finds in that field. May not make sense in a grid, but I think that's the default and designed behavior. I don't know, off hand, how to change it.
    Larry R Pint
    SOFT-STAR, Inc.
    New Prague, MN

    "What is that unforgettable line?” Samuel Beckett

  3. #3
    Join Date
    Feb 2009
    Location
    Kingsbridge, S.Devon, England
    Posts
    1,483

    Default Re: DD_Commit and indexed fields

    Set Field_Option Field File.Field DD_DisplayOnly to (HasRecord(Self)) in OnNewCurrentRecord?
    Peter Crook
    ------------------------------------------------------------------------------------
    Everything should be made as simple as possible, but not simpler.
    -- Albert Einstein

  4. #4
    Join Date
    Feb 2009
    Location
    Rio do Sul - SC
    Posts
    284

    Default Re: DD_Commit and indexed fields

    This
    Code:
    Set File_Field_Option File_Field File.Field DD_DisplayOnly to (IsCommitted(Self))
    in OnNewCurrentRecord of Main_DD works.

    Thanks for helping.
    []'s
    Clayton Schirmer

  5. #5
    Join Date
    Feb 2009
    Posts
    1,175

    Default Re: DD_Commit and indexed fields

    Clayton,

    As noted, the reason it is enterable is that this is a valid finding index. It is actually made NoPut, so you can enter for finding but not save changes. When committed, disabling the DEO would mean you could not use this for finding. While this is a little less flexible, it is valid and it may be exactly what you want. If this is what you want, I think you'd be better off setting the find index for the field to -1. That will cause the commit logic to make a committed DEO disabled.

    For example, the order entry view has a commit field of Date which is indexed. If I want to disable the finding I could add the following to the orderhea dd object within the view.

    Code:
    Function Field_Index Integer iField Returns Integer
        Integer iDateFld iIndex
        Get_FieldNumber OrderHea.Order_Date to iDateFld 
        If (iField=iDateFld) Begin
            Move -1 to iIndex
        End
        Else Begin
            Forward Get Field_Index iField to iIndex
        End
        Function_Return iIndex
    End_Function
    I think this would be better than setting the File_Field_Option (for some reason that solution worries me).

    -John

  6. #6
    Join Date
    Feb 2009
    Location
    Pine Island, Forida
    Posts
    2,063

    Default Re: DD_Commit and indexed fields

    Nice explanation.

    Dennis - would be nice to have this in doc.

    fv
    Frank Valcarcel
    Cove Systems, Inc.
    Pine Island, Florida USA
    fv@covesys.com
    (239) 823-7976

  7. #7
    Join Date
    Feb 2009
    Location
    Rio do Sul - SC
    Posts
    284

    Default Re: DD_Commit and indexed fields

    John,

    Thanks for clarifying this.

    I agree with that when the field is part of the main DD of the view, let the users find records.

    My point is when it is a foreign field - parent or child, doesn't matter. If it is a foreign field and a committed record/field, why allow finding if the field/content cannot be changed? And keep in mind that this only happens when the main file of the server of the DEO is a foreign file - in that case of the cdbCJgrid the main file of the its server is a child table.

    Thanks again.
    []'s
    Clayton Schirmer

  8. #8
    Join Date
    Feb 2009
    Posts
    1,175

    Default Re: DD_Commit and indexed fields

    Clayton,

    I'm not sure I follow. Could your explain this in the context of our order entry view?

    -John

  9. #9
    Join Date
    Feb 2009
    Location
    Brazil
    Posts
    3,463

    Default Re: DD_Commit and indexed fields

    I guess he is trying to say this:

    In a order entry scenario, prevent the user to change the customer for a "committed" order.
    or
    in a order-detail grid, prevent the user to change the Product for a "committed" detail row.

    both are foreigners and he was trying to use the IsCommitted feature to accomplish that.

    Clayton, please correct if I'm wrong.

    Regards
    Samuel Pizarro

  10. #10
    Join Date
    Feb 2009
    Location
    Rio do Sul - SC
    Posts
    284

    Default Re: DD_Commit and indexed fields

    John,

    Here you go - VDF 17.1 https://www.dropbox.com/s/wfl0jer0s2...mit%20test.zip

    I added the table OrderInvoices to the workspace - a child table of OrderHea.

    Changes:
    • cOrderInvoicesDataDictionary.DD - The DD_Commit of Date and Val fields is true.
    • OrderInvoices.vw
      1. OrderHea_DD has a IsCommitted function (OrderHea.Order_Total>300).
      2. oOrderHea_Customer_Number - Server set to Customer_DD.
      3. Added oInvoicesDbCJGrid - Server set to oOrderInvoices_DD.


    Run Order.src.
    Open OrderInvoices.vw
    Press F8 and find the order number 101 record.
    • Customer number is enabled and Customer name is disabled - why allow find a customer if the record is committed?
    • Date column of oInvoicesDbCJGrid is enabled - type any date, press tab.
    • Val column of oInvoicesDbCJGrid is disabled - can't type, press tab.
    • No record save, that's correct because Iscommitted is true but users get confused because they can change the customer and/or type dates.


    Remember, the Server of the DEOs is set to the DDO that the Main_file is a foreign table of the dbview, then File_Field_Committed_Options doesn't set DD_DISPLAYONLY to true.

    Hope I could explain myself better with the example above.

    Thanks.

    PS: You may need reindex the workspace because I'm using a portuguese df_collate.cfg here.
    []'s
    Clayton Schirmer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •