RE: v13 - Relate One Selection issue
Hi Doug, The latest post from Thomas Maul talking about Query By Formula that I find on the forums is from June: http://forums.4d.com/Post/EN/24801062/1/24823734#24823734 ^ this post is restricted to people with access to the R-releases. Here is a full list: http://forums.4d.com/List_Message/EN:0/0/1/1/1/1/0/0/3985/1/-1/461451/1/0/0/0/0/352298223 Are you sure it wasn’t the blog post I referred to? I am pretty sure you are referring to the blog post about driving with the parking brake on: https://blog.4d.com/compatibility-settings-or-driving-with-the-parking-break-onpart-1/ -Tim ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: v13 - Relate One Selection issue
Tim: Thanks for posting those but I was thinking that it was a posting on the 4D Forum. He posts some gems there. Good links. Something to read and re-read. -- Douglas von Roeder 949-336-2902 On Wed, Oct 3, 2018 at 3:34 PM Timothy Penner wrote: > > Thomas Maul posted a valuable, lengthy message about QbF on the 4D Forum > that extolled its virtues. IIRC, he suggested using QbF if your query had > two or more search clauses. (I've tried to find the posting recently and > not been able to — if anyone finds it, it would be a great post to link to.) > > > https://blog.4d.com/compatibility-settings-or-driving-with-the-parking-break-onpart-1/ > > https://blog.4d.com/compatibility-settings-use-period-and-comma-as-placeholders-part-2/ > > -Tim > > > > Timothy Penner > Senior Technical Services Engineer > > 4D Inc > 95 S. Market Street, Suite #240 > San Jose,CA 95113 > United States > > Telephone: +1-408-557-4600 > Fax: +1-408-271-5080 > Email: tpen...@4d.com > Web: www.4D.com > > ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
RE: v13 - Relate One Selection issue
> Thomas Maul posted a valuable, lengthy message about QbF on the 4D Forum that > extolled its virtues. IIRC, he suggested using QbF if your query had two or > more search clauses. (I've tried to find the posting recently and not been > able to — if anyone finds it, it would be a great post to link to.) https://blog.4d.com/compatibility-settings-or-driving-with-the-parking-break-onpart-1/ https://blog.4d.com/compatibility-settings-use-period-and-comma-as-placeholders-part-2/ -Tim ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: v13 - Relate One Selection issue
Thanks Doug, and Arnaud The issue was one or more damaged indexes. After a repair everything seems to be working as it should. Thanks for the insight into QbF, I'll look into it. Chip On Wed, 3 Oct 2018 09:21:19 -0700, Douglas von Roeder via 4D_Tech wrote: > If you check the checkboxes in the Compatability tab so that Query by > formula uses SQL joins, you can traverse the many to many using Query by > formula. You'll want to run QbF on the server, as well. > > Once that's set up, QbF becomes a very powerful tool. > > Thomas Maul posted a valuable, lengthy message about QbF on the 4D Forum > that extolled its virtues. IIRC, he suggested using QbF if your query had > two or more search clauses. (I've tried to find the posting recently and > not been able to — if anyone finds it, it would be a great post to > link to.) > > -- > Douglas von Roeder > 949-336-2902 > > > On Wed, Oct 3, 2018 at 5:57 AM Arnaud de Montard via 4D_Tech < > 4d_tech@lists.4d.com> wrote: > >> >>> Le 2 oct. 2018 à 20:10, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> >> a écrit : >>> >>> [...] >>> >>> I ask because it is not, even after a restart of 4D >> >> The doc says it should: >> "The RELATE ONE SELECTION command creates a new selection of records for >> the table oneTable, based on the selection of records in the table >> manyTable and *** loads the first record of the new selection as the >> current record ***." >> >> I'd try something like this: >> >> >> >> QUERY([Sample_Animal_Link];[Sample_Animal_Link]Sample_ID=[Samples]Sample_ID) >> If(found records([Sample_Animal_Link])>0) >>RELATE ONE SELECTION([Sample_Animal_Link];[Animal]) >>If(found records([Animal])>0) >> ASSERT([Animal]primaryKey not empty) >>End if >> End if >> >> Or [Sample_Animal_Link] orphan of animal? >> >> BTW: >>//given a [Samples] selection >> RELATE ONE SELECTION([Samples];[Animal]) >> //Samples..Sample_Animal_Link..Animal >> This use of RELATE ONE SELECTION is not documented but works (or used to >> work, it's a while since I didn't try) >> >> -- >> Arnaud de Montard >> >> >> >> ** >> 4D Internet Users Group (4D iNUG) >> Archive: http://lists.4d.com/archives.html >> Options: https://lists.4d.com/mailman/options/4d_tech >> Unsub: mailto:4d_tech-unsubscr...@lists.4d.com >> ** > ** > 4D Internet Users Group (4D iNUG) > Archive: http://lists.4d.com/archives.html > Options: https://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ** --- Gas is for washing parts Alcohol is for drinkin' Nitromethane is for racing ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: v13 - Relate One Selection issue
> Le 2 oct. 2018 à 20:10, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> a > écrit : > > [...] > > I ask because it is not, even after a restart of 4D The doc says it should: "The RELATE ONE SELECTION command creates a new selection of records for the table oneTable, based on the selection of records in the table manyTable and *** loads the first record of the new selection as the current record ***." I'd try something like this: QUERY([Sample_Animal_Link];[Sample_Animal_Link]Sample_ID=[Samples]Sample_ID) If(found records([Sample_Animal_Link])>0) RELATE ONE SELECTION([Sample_Animal_Link];[Animal]) If(found records([Animal])>0) ASSERT([Animal]primaryKey not empty) End if End if Or [Sample_Animal_Link] orphan of animal? BTW: //given a [Samples] selection RELATE ONE SELECTION([Samples];[Animal]) //Samples..Sample_Animal_Link..Animal This use of RELATE ONE SELECTION is not documented but works (or used to work, it's a while since I didn't try) -- Arnaud de Montard ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: v13 - Relate One Selection issue
Thanks Tim, it appears to have been one or more damaged indices Cihp On Tue, 02 Oct 2018 16:00:36 -0500, Tim Nevels via 4D_Tech wrote: > On Oct 2, 2018, at 2:00 PM, Chip Scheide wrote: > >> given this table configuration >> >> Animal <-- Animal_Sample_Link ---> Samples >> >> if there is at least 1 [Sample_Animal_Link] record shouldn't the >> following code load the animal record(s)? >> >> QUERY([Sample_Animal_Link];[Sample_Animal_Link]Sample_ID=[Samples]Sample_ID) >> RELATE ONE SELECTION([Sample_Animal_Link];[Animal]) >> >> I ask because it is not, even after a restart of 4D > > Four thoughts came to mind: > > 1. index damage so the query or relation is failing > > 2. Could there be other relations that 4D could go through to get > from Sample_Animal_Link to Animal? Maybe 4D picked another set of > relations to follow to get from here to there. Result is wrong > selection of records. > > 3. Are you running this code from a button or a menu item while a > MODIFY SELECTION or DISPLAY SELECTION is running? Sometimes 4D will > not do certain relational things because it can “break” the MODIFY > SELECTION or DISPLAY SELECTION if any of the tables in question are > involved. > > 4. If you do a QUERY or QUERY WITH ARRAY instead of a RELATE ONE > SELECTION, do you get the expected selection of records? If so then > see #2 or #3 above. > > Tim > > * > Tim Nevels > Innovative Solutions > 785-749-3444 > timnev...@mac.com > * > > ** > 4D Internet Users Group (4D iNUG) > Archive: http://lists.4d.com/archives.html > Options: https://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ** --- Gas is for washing parts Alcohol is for drinkin' Nitromethane is for racing ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: v13 - Relate One Selection issue
On Oct 2, 2018, at 2:00 PM, Chip Scheide wrote: > given this table configuration > > Animal <-- Animal_Sample_Link ---> Samples > > if there is at least 1 [Sample_Animal_Link] record shouldn't the > following code load the animal record(s)? > > QUERY([Sample_Animal_Link];[Sample_Animal_Link]Sample_ID=[Samples]Sample_ID) > RELATE ONE SELECTION([Sample_Animal_Link];[Animal]) > > I ask because it is not, even after a restart of 4D Four thoughts came to mind: 1. index damage so the query or relation is failing 2. Could there be other relations that 4D could go through to get from Sample_Animal_Link to Animal? Maybe 4D picked another set of relations to follow to get from here to there. Result is wrong selection of records. 3. Are you running this code from a button or a menu item while a MODIFY SELECTION or DISPLAY SELECTION is running? Sometimes 4D will not do certain relational things because it can “break” the MODIFY SELECTION or DISPLAY SELECTION if any of the tables in question are involved. 4. If you do a QUERY or QUERY WITH ARRAY instead of a RELATE ONE SELECTION, do you get the expected selection of records? If so then see #2 or #3 above. Tim * Tim Nevels Innovative Solutions 785-749-3444 timnev...@mac.com * ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
v13 - Relate One Selection issue
given this table configuration Animal <-- Animal_Sample_Link ---> Samples if there is at least 1 [Sample_Animal_Link] record shouldn't the following code load the animal record(s)? QUERY([Sample_Animal_Link];[Sample_Animal_Link]Sample_ID=[Samples]Sample_ID) RELATE ONE SELECTION([Sample_Animal_Link];[Animal]) I ask because it is not, even after a restart of 4D Thanks Chip --- Gas is for washing parts Alcohol is for drinkin' Nitromethane is for racing ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **