Author: MB Software Solutions, LLC
Posted: 2019-10-02 13:14:25 Link
We've seen this before (and I did it 2 decades ago): REPLACE
MyTable.MyField with SomeOtherTable.SomeField
The implication is that "replace the MyField value in the MyTable
table." But if one doesn't use the IN clause, will there ever be any
chance that the update to MyTable.MyField would fail?
tia,
--Mike
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: https://leafe.com/archives/byMID/92c088b2-8be5-f8df-33a6-bc4229de87c4@mbsoftwaresolutions.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: Frank Cazabon
Posted: 2019-10-02 13:41:53 Link
Yes, it fails if you are at EOF in the currently selected table, if I
recall correctly.
Frank.
Frank Cazabon
On 02/10/2019 02:14 PM, MB Software Solutions, LLC wrote:
> We've seen this before (and I did it 2 decades ago): REPLACE
> MyTable.MyField with SomeOtherTable.SomeField
>
> The implication is that "replace the MyField value in the MyTable
> table." But if one doesn't use the IN clause, will there ever be any
> chance that the update to MyTable.MyField would fail?
>
> tia,
> --Mike
>
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: https://leafe.com/archives/byMID/f32c2e96-1dfc-3aeb-da47-55c5ab9e8d19@gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: MB Software Solutions, LLC
Posted: 2019-10-02 13:54:45 Link
This app seems to make a lot of assumptions (!!!) about record
position. I noticed this a lot 20 years ago too. Not sure how old this
code is but I thought I saw something that said early 2000s?
On 10/2/2019 2:41 PM, Frank Cazabon wrote:
> Yes, it fails if you are at EOF in the currently selected table, if I
> recall correctly.
>
> Frank.
>
> Frank Cazabon
>
> On 02/10/2019 02:14 PM, MB Software Solutions, LLC wrote:
>> We've seen this before (and I did it 2 decades ago): REPLACE
>> MyTable.MyField with SomeOtherTable.SomeField
>>
>> The implication is that "replace the MyField value in the MyTable
>> table." But if one doesn't use the IN clause, will there ever be any
>> chance that the update to MyTable.MyField would fail?
>>
>> tia,
>> --Mike
>>
>>
>>
>> ---
>> This email has been checked for viruses by Avast antivirus software.
>> https://www.avast.com/antivirus
>>
>>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: https://leafe.com/archives/byMID/e74590ac-b4b7-11de-313a-3c6e85c62fee@mbsoftwaresolutions.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: <juergen@wondzinski.de>
Posted: 2019-10-03 03:38:29 Link
Hi Mike,
Imagine this scenario:
USE AA IN 0
USE BB IN 0
USE CC IN 0
Select AA
&& do something unsuccessful in that table:
LOCATE FOR AA.Field1 = "Nonsense"
&& Now your replace:
REPLACE BB.Field1 WITH CC.Field2
This Replace will not happen, since the working alias of the Replace is AA (which is on EOF), regardless which fields (or field aliases) are used in the fields list. Additionally the FOR and WHILE conditions are by default equated against the current alias.
Therefor it's considered good practice to always add the IN clause if in doubt, so that the working alias is temporarily set to the desired alias.
wOOdy
-----Ursprüngliche Nachricht-----
Von: ProFox <profox-bounces@leafe.com> Im Auftrag von MB Software Solutions, LLC
Gesendet: Mittwoch, 2. Oktober 2019 20:14
An: profox@leafe.com
Betreff: Bad style, but any chance it would ever fail to update properly?
We've seen this before (and I did it 2 decades ago): REPLACE MyTable.MyField with SomeOtherTable.SomeField
The implication is that "replace the MyField value in the MyTable table." But if one doesn't use the IN clause, will there ever be any chance that the update to MyTable.MyField would fail?
tia,
--Mike
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: https://leafe.com/archives/byMID/004a01d579c5$eedbad30$cc930790$@wondzinski.de
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Author: MB Software Solutions, LLC
Posted: 2019-10-03 10:23:28 Link
I created this form custom method to allow me to only update the field
if the value has changed. This replaces lots of unconditional REPLACEs
in a form.
LPARAMETERS tcTable, tcField, tvValue
LOCAL lvCurrent as Variant
lvCurrent = EVALUATE(tcTable + "." + tcField)
IF lvCurrent <> tvValue THEN
REPLACE (tcField) WITH (tvValue) IN (tcTable)
ENDIF
(This is in theory yet...implementing it soon.)
So instead of
REPLACE order.cost4des WITH 'Fuel Surcharge'
I call
thisform.UpdateTableValue('order','cost4des','Fuel Surcharge')
On 10/2/2019 2:14 PM, MB Software Solutions, LLC wrote:
> We've seen this before (and I did it 2 decades ago): REPLACE
> MyTable.MyField with SomeOtherTable.SomeField
>
> The implication is that "replace the MyField value in the MyTable
> table." But if one doesn't use the IN clause, will there ever be any
> chance that the update to MyTable.MyField would fail?
>
> tia,
> --Mike
>
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: https://leafe.com/archives/byMID/2c6df793-be93-e091-ec99-12c9a67c8473@mbsoftwaresolutions.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.