GUID Field Name in DB
 

GUID Field Name in DB

7 posts, 1 answered
  1. Roger Blanchard
    Roger Blanchard avatar
    381 posts
    Registered:
    29 Jun 2018
    28 Jan 2019
    Link to this post
    I have many tables where we have field names called "GUID". When I create a BE for these the GUID field in the TT never gets populated when fetching data use the BE:RetreiveData.The AttachDataSources looks like what is below. I did try changing the name to RecordGUID and that does appear to work. Before I go and change my DB for all these tables I wanted to make sure that having a field named GUID would have this issue.

    THIS-OBJECT:AttachDataSource (BUFFER eDonorHist:HANDLE,
                                          DATA-SOURCE src_DonorHist:HANDLE, "
                                          CustomerNum,DonorHist.CustomerNum,
                                          DropoffDate,DonorHist.DropoffDate,
                                          Descrpt,DonorHist.Descrpt,
                                          HardGoodCnt,DonorHist.HardGoodCnt,
                                          SoftGoodCnt,DonorHist.SoftGoodCnt,
                                          LargeItemCnt,DonorHist.LargeItemCnt,
                                          MiscCnt,DonorHist.MiscCnt,
                                          DonationValue,DonorHist.DonationValue,
                                          Email,DonorHist.Email,
                                          StoreId,DonorHist.StoreId,
                                          DropoffTime,DonorHist.DropoffTime,
                                          EmployeeNum,DonorHist.EmployeeNum,
                                          MailGUID,DonorHist.MailGUID,
                                          GUID,DonorHist.GUID":U) .
  2. Roger Blanchard
    Roger Blanchard avatar
    381 posts
    Registered:
    29 Jun 2018
    28 Jan 2019 in reply to Roger Blanchard
    Link to this post
    I was mistaken. I changed the name to RecordGUID and I am still seeing issues. I will have to dig into it a bit more. We are using the create trigger to assign the GUID and have verified the field is assigned with a proper value. However, in RetrieveData the value of the GUID is always blank.
  3. Mike Fechner
    Mike Fechner avatar
    319 posts
    Registered:
    14 Sep 2016
    Answered
    28 Jan 2019
    Link to this post
    Is the value actually written to the DB? If's your setting the value in the write trigger, you need to add the field to the AssignSkipList or better AssignSkipDictionary. See the template of the DataAccess classes contructor. 
  4. Roger Blanchard
    Roger Blanchard avatar
    381 posts
    Registered:
    29 Jun 2018
    28 Jan 2019 in reply to Mike Fechner
    Link to this post
    I am assigning in the create trigger. Let me look at the assignskipdictionary.

    as far as if it was being written to the DB...I did have values in there but it may have been older data before I added this BE. I am investigating right now.

    thanks.
  5. Roger Blanchard
    Roger Blanchard avatar
    381 posts
    Registered:
    29 Jun 2018
    28 Jan 2019 in reply to Mike Fechner
    Link to this post
    This helps

     /* Fields that are not assigned to the database record when a new record is created. */
            /* THIS-OBJECT:AssignSkipList = "<key fields>":U. */
                    THIS-OBJECT:AssignSkipDictionary:Add ("eDonorHist":U, "GUID":U).

    Thanks Mike.
  6. Carl Verbiest
    Carl Verbiest avatar
    59 posts
    Registered:
    12 Oct 2018
    29 Jan 2019
    Link to this post
    IMHO it's better to assign them in the write trigger instead of the create trigger
    Use an initial van of ? or "" and test if the value is filled out and only assign if it is empty

    if Guid > ""
    then .
    else RecordGuid = GUID.

    This allows for client or backend logic to assign the RecordGuid earlier if they require it .
    Use unique indexes to ensure the guid is unique

    Just my 0,02€
     
  7. Roger Blanchard
    Roger Blanchard avatar
    381 posts
    Registered:
    29 Jun 2018
    30 Jan 2019 in reply to Carl Verbiest
    Link to this post
    Thanks Carl.
7 posts, 1 answered