Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DBGETPROP malfunction?
Message
From
29/01/2017 05:18:14
 
 
To
29/01/2017 04:05:56
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01647100
Message ID:
01647107
Views:
41
>>>>Hi,
>>>>
>>>>I have troubles with DBGETPROP function to get the caption:
>>>>
>>>>
>>>>CREATE DATABASE test
>>>>CREATE TABLE testtable (field1 c(10), field2 c(10))
>>>>DBSETPROP('Testtable','Field','Caption','My Long Caption')
>>>>? the caption is '+ DBGETPROP('testtable.field2','Field','Caption')
>>>>
>>>>
>>>>errors "command contains unrecognized phrase / keyword" on row 4
>>>>
>>>>What is possibly going on here?
>>>>
>>>>Regards,
>>>>Koen
>>>
>>>Slow Sunday morning, is it?
>>>
>>>For the error you're reporting, you're just missing a tick to start the "the caption is " string.
>>>
>>>But, for what you're intending to do, an error will pop up in the row (ahem, line...) 3. When you're referring to a field property, you must fully specify the field, otherwise VFP won't have a clue on your intentions, as you did - correctly - in the GET function.
>>>
>>>
>>>CREATE DATABASE test
>>>CREATE TABLE testtable (field1 c(10), field2 c(10))
>>>DBSETPROP('Testtable.field2','Field','Caption','My Long Caption')  && didn't specify the field, 
>>>? 'the caption is '+ DBGETPROP('testtable.field2','Field','Caption')   && properly formed string
>>>
>>
>>Antonio,
>>Yes this is a sundamonring error on error!!!
>>However quickly corrected and added the forgotten tick
>>still you clam I did not specify the field however
>>
>>
>>DBSETPROP('Testtable.field2','Field','Caption','My Long Caption')  && field = field2 
>>
>>and error message is "cannot find object testable in database"
>>
>>Regards,
>>Koen
>
>Koen, bear in mind that in Portugal is earlier than in the Netherlands, so it's more "Sunday morning" to me than it is to you, therefore my state of consciousnesses is still waiting for a boost, or a coffee, whatever, but I'm not quite following what you're saying.
>
>In your original code, you had
>
>DBSETPROP('Testtable','Field','Caption','My Long Caption')
>
>
>Since you're required to specify the field of the table for which you want to set a property, this code will raise an error. The code I posted corrected this, and will work unless, of course, there is no table named "Testtable" in the current database, or no field named "field2" in the "Testtable" table. But this was set in the previous two lines, wasn't it?
Antonio,
Yes I do realize, but please consider also the initial posting was also done for Dutch standards at a very unusual time, due to the fact I presently suffering from a total time disorder after my surgery. Nevermind.
I will start again.
In a situation in the project I am currently working I have need to know what the caption is of surveyed fields, so I tried to make use of the dbgetprop(). This resulted only in errors. So I 'googled' and found an article by Tamar : https://books.google.nl/books?id=-6wGndJSbkcC&pg=PA161&lpg=PA161&dq=dbgetprop+vfp&source=bl&ots=7XL5HHNw59&sig=39iggMHuSPLouF0ruYr96Sh-Jfs&hl=nl&sa=X&ved=0ahUKEwijwcDhjefRAhUrBMAKHfOYDyQQ6AEIYjAH#v=onepage&q=dbgetprop%20vfp&f=false
I tried that procedure and again erroring. So afterall I C&P the procedure and published here. - sorry a small typo, a ' missing.

So to avoid any confusing I will repost and if you or others have lust to review, but coffee first please, teach me how to make use of dbgetprop() to find the caption of any field.
CLOSE DATABASES all
ERASE test*.*
CREATE DATABASE test
CREATE TABLE testtable (field1 c(10), field2 c(10))
DBSETPROP('Testtable','Field','Caption','My Long Caption')
? 'the caption is '+ DBGETPROP('testtable.field2','Field','Caption')
Regards,
Koen
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform