Field Reference parameter

IT it at plastipol.com
Thu Jan 18 07:18:01 EST 2018


Hi Robert,

I have tried it. But when you pass the field 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.

xavier

> El 18/1/2018, a las 11:50, omnis <omnis at ra-schoening.de> escribió:
> 
> Hi Xavier
> 
> are you calling the method in an entry field via "On evAfter"?
> 
> then try using the "$cfield()."-Notation to access field properties:
> 
> On evAfter     ;; Event Parameters - pClickedField, pClickedWindow, pMenuLine, pCommandNumber, pRow
> 	Calculate lcFiedlname as $cfield.$name()
> 	Calculate lcDataname as $cfield.$dataname()
> 
> Or do you mean the database field in the row you are using? Then you will need the $dataname-Proprty to get the content into lcDataname. Afterwards you will have to strip the rowname from that content, e .g.
> 
> Calculate lcFieldname as mid(lcDataname,pos('.',lcDataname)+1)
> 
> Hope that helps
> 
> Regards
> 
> Robert
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: omnisdev-en [mailto:omnisdev-en-bounces at lists.omnis-dev.com] Im Auftrag von IT
> Gesendet: Donnerstag, 18. Januar 2018 09:13
> An: OmnisDev List - English
> Betreff: Re: Field Reference parameter
> 
> 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
> 
> _____________________________________________________________
> 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