Field Reference parameter
IT
it at plastipol.com
Thu Jan 18 03:12:36 EST 2018
This doesn’t work, the reference finally passed is lFieldName. I want pass reference of Whatever field.
For example, you are in enter data and in some fields you wan’t to test for a unique index value.
You have a row (ivMaestro) defined from sql class with some methods. One method is $TestForAUniqueIndexValue() that need a field reference as a parameter.
When you are in an enter data you cant test for a unique index value several time for different fields.
So depending on the field you are, lvFieldToTest will contain a diferent field name. The code bellow doesn’t work.
Calculate lvFieldToTest as #EN
Do ivMaestro.$TestForAUniqueIndexValue([lvFieldToTest]) Returns #F ;;
You cant try different ways to pass lvFieldToTest like [lvFieldToTest] or nam(lvFieldToTest) with no luck.
Only a variable can be passed to a Field reference parameter variable. Any calculation or attempts to send the name of a variable as a string will fail.
So, or I am omitting something or this limits very much the use of Field Reference as parameter.
regards
xavier
> El 17/1/2018, a las 19:18, Peter van Rooij <pfvanrooij at gmail.com> escribió:
>
> Hello Xavier
>
> Calculate lFieldName as ‘Whatever'
> Do ivMaestro.$TestForAUniqueIndexValue(lFieldName) Returns #F
>
>
>> On 17 Jan 2018, at 16:53, IT <it at plastipol.com> wrote:
>>
>> Hi All,
>>
>> I have a table with a method to test for a unique index value running SQL not DML.
>> The method $TestForAUniqueIndexValue has a Field parameter.
>> If i pass a variable, the method works ok. Any try to use some kind of dynamic parameter fails.Things like a calculation results in an error: "Attempt to assign a calculation to a field reference parameter”. Using the nam() function or enclosing the variable name in quotes or square bracket fail.
>>
>> This works
>> Do ivMaestro.$TestForAUniqueIndexValue(ivMaestro.USR_CODIGO) Returns #F
>>
>> This doesn’t work
>> Do ivMaestro.$TestForAUniqueIndexValue(#EN) Returns #F ;;
>>
>> Any one know if there is a way to send the name of the field as a parameter in a dynamically way?
>>
>> regards
>>
>>
>> xavier
>> _____________________________________________________________
>> Manage your list subscriptions at http://lists.omnis-dev.com
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
More information about the omnisdev-en
mailing list