Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Coordinate Tableupdate() with several tables.
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00077500
Message ID:
00080994
Views:
48
>>>>>Try putting the aliases of the tables you want embedded in a transaction into an array that can be processed by tableupdate.
>>>>>
>>>>>.aAliases[1] = "Table1"
>>>>>.aAliases[2] = "Table2"
>>>>>.aAliases[3] = "Table3"
>>
>>
>>
>>Hi Steve,
>>
>>Your technique works great with my forms that do updating! I am intersted in seeing what is in your .setAliases method though. I don't always update the same tables, and I am trying to find a way to populate the aAliases array with only the table names that need to go through this tableupdate() routine. If you don't mind sharing, and you have time to respond, I sure would like to take a look at your method code for this. I am trying a few things now, but haven't had much success yet.
>>
>>Thanks.
>>
>>John.
>
>John,
>
>Here it is. The parameter is a comma delimited string of aliases that
>are loaded into the array for transaction processing.
>
>
>*
>* Sets the alias(es) for transaction processing.  This
>* class will process whatever is in the array as one
>* transaction.  The programmer can set this value at
>* any time allowing tremendous flexibility in what tables
>* or views need to be included in a transaction.
>*
>LPARAMETERS lcAliases
>LOCAL i, lnComma, lnStart, lnCount
>
>WITH THIS



>	*
>	* Start fresh
>	*
>	.paAlias = .F.
>
>	lnCount = 0
>	lnComma = 0
>	lnStart = 1
>	*
>	* The parameter is a comma delimited string of aliases.
>	*
>	FOR i = 1 TO LEN(lcAliases)
>
>		lnCount = lnCount + 1
>		DIMENSION .paAlias[lnCount]
>	
>		lnComma = AT(",", lcAliases, i)
>		IF lnComma <> 0
>			.paAlias[lnCount] = ALLTRIM(SUBSTR(lcAliases, ;
>                                            lnStart, lnComma - lnStart))
>			lnStart = lnComma + 1
>		ELSE
>			.paAlias[lnCount] = ALLTRIM(SUBSTR(lcAliases, lnStart))
>			i = LEN(lcAliases) + 1
>		ENDIF
>	
>	ENDFOR
>
>ENDWITH
>
>
>So there you have it. Not much else to the whole class. The revertdb method simply rolls through the array issuing a tablerevert() for all. The only other thing you need is whatever error checking you want. There's probably folks here who have a better string parser, but what the heck, it works. The key of course is the ability to be able to adjust the aliases you want enclosed in a transaction. oTransaction.SetAliases(cSomeCommaDelimitedStringOfAliases)
>
>This particular array is protected but you could make the array public and simply populate the array elsewhere in a form.
>Steve


Steve,

Thanks again for steering the new guy in the right direction. You've been extremely helpful and generous. I'll try to leave you alone for a while, but I can't make any promises though! Well, for me it's back to work to implement your ideas.

Thanks

John.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform