I have never used link by expression for a set before and was wondering in the following situation if it can be done, should be done, and would it help my situation.
I have a table that should have both an arrival record for an aircraft (designated with an "A" in a field called "type") and a departure record (designated with an "D" in a field called "type"). I say should because sometimes when the parent reservation record is created only the arrival may be known and thus there would only be one record of an "A" type and no "D" record created yet.
I have a need to compare many items between the arrival to the departure, for example to see what the time difference is between the two, or if a service was done on the arrival. I have been using filtered indexes and calculated fields such as:
'Checks the existence of the departure if the record I am on is an arrival
existd = if(type="A",exist(ALLTRIM(STR(RESNUM)+"D"),"res_detail","dupentryd"),.f.)
'looks up the reservation date (rdate) for that departure
existd1 = if(calc->existd=.t.,dtoc(lookupd("F",ALLTRIM(STR(RESNUM)+"D"),"rdate","res_detail","dupentryd"),"1-"),"")
to get the data that I need. As there is quite a lot of this going on, the form is painfully slow. I would like to access the record directly and I was wondering if I could do this with a filtered set somehow.
This means making the parent and child with the same table.
I was thinking this would greatly speed things up. It is the same table which I thought would create issues, but I tried linking it on a one field parameter and it was allowed, and it worked. It did not work as intented, of course, but it did show me two records from the same table on one form.
I did try a simple IF statement in the set linking and it did not work, but I wanted to ask about this practice, OR IS THERE A BETTER WAY. If so, how should the set link expression be constructed. I have never used this before and I was hoping for some sage advice.
I have a table that should have both an arrival record for an aircraft (designated with an "A" in a field called "type") and a departure record (designated with an "D" in a field called "type"). I say should because sometimes when the parent reservation record is created only the arrival may be known and thus there would only be one record of an "A" type and no "D" record created yet.
I have a need to compare many items between the arrival to the departure, for example to see what the time difference is between the two, or if a service was done on the arrival. I have been using filtered indexes and calculated fields such as:
'Checks the existence of the departure if the record I am on is an arrival
existd = if(type="A",exist(ALLTRIM(STR(RESNUM)+"D"),"res_detail","dupentryd"),.f.)
'looks up the reservation date (rdate) for that departure
existd1 = if(calc->existd=.t.,dtoc(lookupd("F",ALLTRIM(STR(RESNUM)+"D"),"rdate","res_detail","dupentryd"),"1-"),"")
to get the data that I need. As there is quite a lot of this going on, the form is painfully slow. I would like to access the record directly and I was wondering if I could do this with a filtered set somehow.
This means making the parent and child with the same table.
I was thinking this would greatly speed things up. It is the same table which I thought would create issues, but I tried linking it on a one field parameter and it was allowed, and it worked. It did not work as intented, of course, but it did show me two records from the same table on one form.
I did try a simple IF statement in the set linking and it did not work, but I wanted to ask about this practice, OR IS THERE A BETTER WAY. If so, how should the set link expression be constructed. I have never used this before and I was hoping for some sage advice.
Comment