NetTalk Central

Author Topic: Code before field lookup  (Read 3202 times)

Keith

  • Sr. Member
  • ****
  • Posts: 306
    • View Profile
    • Email
Code before field lookup
« on: August 11, 2014, 01:59:21 AM »
I want to execute some code to add records to the table which is used as the Lookup for a field (field 'RoomNumber' looks up table 'Rooms' and I want to add records to 'Rooms' before the Lookup executes).

Which is the embed point I could use?

Thanks

Keith
Clarion 10.0.0 build 12799
NetTalk 9.31
StringTheory 2.65
InsightGraphing 2.27

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Code before field lookup
« Reply #1 on: August 11, 2014, 02:17:00 AM »
>>  I want to add records to 'Rooms' before the Lookup executes).

Is Rooms a memory table?
Or put another way - why aren't the rooms in the table already?

cheers
Bruce


Keith

  • Sr. Member
  • ****
  • Posts: 306
    • View Profile
    • Email
Re: Code before field lookup
« Reply #2 on: August 11, 2014, 01:57:05 PM »
Hi Bruce

I have a table of all rooms.  There is also a table of related bookings (start and end dates).  I have a table of 'available rooms' and this is the one that is quoted for the lookup (the lookup must see only those rooms that are available).

So, my code will delete any rooms in the 'rooms available' table for the current session id and add back those rooms that would be available for the current booking.  I need to execute this code before the lookup.  I found an embed point 'After Lookup' and tried a number of places in the source but with no success.

Thanks

Keith
Clarion 10.0.0 build 12799
NetTalk 9.31
StringTheory 2.65
InsightGraphing 2.27

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Code before field lookup
« Reply #3 on: August 11, 2014, 09:41:36 PM »
>> So, my code will delete any rooms in the 'rooms available' table for the current session id

It sounds like you are making something very simple into something very complex.

Why not just do a lookup on all the rooms, adding a filter to filter out rooms that are not available?

cheers
Bruce

Keith

  • Sr. Member
  • ****
  • Posts: 306
    • View Profile
    • Email
Re: Code before field lookup
« Reply #4 on: August 11, 2014, 11:49:31 PM »
Bruce

Thanks for the 'tutoring advice'.  I did come to the conclusion before seeing your reply that you would say 'use a filter'  :) but the reason I had not followed through was that the 'filter' is about 20 lines of code.

However, I then realised that this could be placed in the 'Inside Browse Loop/Validate Record' embed point (If <lots of conditions> then cycle.) and this now works.

Keith
Clarion 10.0.0 build 12799
NetTalk 9.31
StringTheory 2.65
InsightGraphing 2.27