The filePro Group - A second attempt
Walter Vaughan
wvaughan at steelerubber.com
Wed Jul 25 15:14:12 PDT 2007
fp at casabellagallery.com wrote:
> Take a moment to review the site and let me know what you think.
You may have missed it since you were off the mailing list, but I think (on my
way out the door) the community should be developing a "filePro Rosetta Stone".
I see a future in converting filePro logic into sql statements starting from the
most simple to the most complex, rather than future developers looking to learn
filePro for new applications.
<paste type=example>
Updating a field from the same record
Say you wanted to update a field in a record with data from that same record. In
the case of filepro you would most likely create a processing only report and a
table to process.
In the following examples in an other field.
* field_1 contains data like "XX45"
* field_2 contains data like "U-ZZ"
* field_3 is supposed to contain the numeric value we want to get from
field_1 that are the third and fourth characters
filePro Code
If: 3 eq "" and 2 co "U-"
Then: 3=mid(1,"3","2")
SQL Code
update table_name
set field_3 = int4(substring(table_name.field_1,3,2))
where (table_name.field_2 like 'U-%' and field_3 is null)
A couple of interesting things...
* Since field_3 is numeric we cast the output of the substring with int4()
</paste>
More information about the Filepro-list
mailing list