What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

4D Tech mailing list
What a weird ’subject’ for this question. Sorry. Seems quite confusing.

————

Say that the “variable or expression” for a on-screen object is     Form.LB.Browser.en_edit.FirstName
This is entirely reasonable, as 4D’s ORDA has taught us to use such ‘expressions’ for the fields

BUT in the script for this, there is no way to use Self (as there would be if it was a 4D variable) because it is an ATTRIBUTE of an object.

This is stupid.
It makes it impossible to write a script as simple as:

Self->:= Uppercase(Self->)

Because Self returns a nil pointer.

So how on earth do we retrieve and set the value under these circumstances? [GENERICALLY; I do not want to use the object’s “expression” in the script]

There is no such 4D method as   OBJECT Get Value( )     OBJECT SET VALUE( )
If there were, we could write:

OBJECT SET VALUE(*; OBJECT Get Name; Uppercase( OBJECT Get Value(Object Get Name) ) )  // really cumbersome, but is hypothetical because there is no ‘OBJECT GET / SET VALUE’ command.


**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

4D Tech mailing list
This was annoying the first time I ran into it, but overall hasn’t really caused any serious problems for generic programming. If you name the object with the expression, you can use something like:

Form[Object Get name(Object current)]:=x

If you need to set properties on a form object (control) like color/disabled/etc, you can use the object name as well. The only problem is you may not be able to effectively use an object name prefix to set properties on a group of controls.

I agree it would be nice if references to form controls and access to their values had been thought through a little better, but I doubt it’s likely to change now.

Jim Crate


> On Feb 3, 2020, at 10:35 PM, Chris Belanger via 4D_Tech <[hidden email]> wrote:
>
> What a weird ’subject’ for this question. Sorry. Seems quite confusing.
>
> ————
>
> Say that the “variable or expression” for a on-screen object is     Form.LB.Browser.en_edit.FirstName
> This is entirely reasonable, as 4D’s ORDA has taught us to use such ‘expressions’ for the fields
>
> BUT in the script for this, there is no way to use Self (as there would be if it was a 4D variable) because it is an ATTRIBUTE of an object.
>
> This is stupid.
> It makes it impossible to write a script as simple as:
>
> Self->:= Uppercase(Self->)
>
> Because Self returns a nil pointer.
>
> So how on earth do we retrieve and set the value under these circumstances? [GENERICALLY; I do not want to use the object’s “expression” in the script]
>
> There is no such 4D method as   OBJECT Get Value( )     OBJECT SET VALUE( )
> If there were, we could write:
>
> OBJECT SET VALUE(*; OBJECT Get Name; Uppercase( OBJECT Get Value(Object Get Name) ) )  // really cumbersome, but is hypothetical because there is no ‘OBJECT GET / SET VALUE’ command.
>
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[hidden email]
> **********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

4D Tech mailing list
In reply to this post by 4D Tech mailing list
Chris,
For a listbox the equivalent of 'self' is the Current Item Datasource.
Let's say that is Form.LB.currentItem in keeping with your example. (It
could be something else just as well.) This is the object that corresponds
to the listbox row generally speaking. So you could have a method that
validates and formats the whole object that you pass that object to.

If it's a big object and this would take noticeable time or you need to do
something more elaborate like lookups you can know still use the row and
column (LISTBOX GET CELL POSITION) to work out what's changed.

The object script has access to This. So you could use
This.FirstName:=Uppercase(This.FirstName) in the column script.

When using ORDA on a form keep in mind changing the data is what we want to
do. The display will update itself if you are using Expressions.

Let's say I have an Input I want to capitalize instead of a listbox column.
Let's say Form.myInput is the expression and the input object is named
InputObject. When the user changes the data I have options:

1) Self->:= Uppercase(Self->)

2) Object get pointer(Object named;"InputObject")->:=Uppercase(Object get
pointer(Object named;"InputObject")->)

3) Form.myInput:=Uppercase(Form.myInput)

#1 is the old-school approach. Simple but opaque (what exactly is Self
pointing at?)
#2 is the newer-school approach taking advantage of dynamic variables.
Better sense of what is being operated on.
#3 simply updates the property value directly. Completely transparent about
what we are acting on.

#1 and #2 are manipulating the input object which then updates Form.myInput
whereas #3 simply updates Form.myInput directly and then the form input
updates itself to reflect that.

Hope this helps.


On Mon, Feb 3, 2020 at 7:35 PM Chris Belanger via 4D_Tech <
[hidden email]> wrote:

> What a weird ’subject’ for this question. Sorry. Seems quite confusing.
>
> ————
>
> Say that the “variable or expression” for a on-screen object is
>  Form.LB.Browser.en_edit.FirstName
> This is entirely reasonable, as 4D’s ORDA has taught us to use such
> ‘expressions’ for the fields
>
> BUT in the script for this, there is no way to use Self (as there would be
> if it was a 4D variable) because it is an ATTRIBUTE of an object.
>
> This is stupid.
> It makes it impossible to write a script as simple as:
>
> Self->:= Uppercase(Self->)
>
> Because Self returns a nil pointer.
>
> So how on earth do we retrieve and set the value under these
> circumstances? [GENERICALLY; I do not want to use the object’s “expression”
> in the script]
>
> There is no such 4D method as   OBJECT Get Value( )     OBJECT SET VALUE( )
> If there were, we could write:
>
> OBJECT SET VALUE(*; OBJECT Get Name; Uppercase( OBJECT Get Value(Object
> Get Name) ) )  // really cumbersome, but is hypothetical because there is
> no ‘OBJECT GET / SET VALUE’ command.
>
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[hidden email]
> **********************************************************************



--
Kirk Brooks
San Francisco, CA
=======================

What can be said, can be said clearly,
and what you can’t say, you should shut up about

*Wittgenstein and the Computer *
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

4D Tech mailing list
In reply to this post by 4D Tech mailing list
I believe this is related to other topic that was discussed here, namely
that you cannot get pointer to object properties. So there is no way how to
get a pointer pointing to Form.LB.Browser.en_edit.FirstName.

As you noticed, you can still manipulate such form objects with commands
that accept object name, but there are no such commands that would allow to
get / set object value.

What you maybe could do is, for example, is to use the same object name as
is the property name, and then you could use
Form[OBJECT Get name] := newValue

but the generic method for properties like
Form.LB.Browser.en_edit.FirstName would be a bit complex.

Peter Bozek


On Tue, Feb 4, 2020 at 4:35 AM Chris Belanger via 4D_Tech <
[hidden email]> wrote:

> What a weird ’subject’ for this question. Sorry. Seems quite confusing.
>
> ————
>
> Say that the “variable or expression” for a on-screen object is
>  Form.LB.Browser.en_edit.FirstName
> This is entirely reasonable, as 4D’s ORDA has taught us to use such
> ‘expressions’ for the fields
>
> BUT in the script for this, there is no way to use Self (as there would be
> if it was a 4D variable) because it is an ATTRIBUTE of an object.
>
> This is stupid.
> It makes it impossible to write a script as simple as:
>
> Self->:= Uppercase(Self->)
>
> Because Self returns a nil pointer.
>
> So how on earth do we retrieve and set the value under these
> circumstances? [GENERICALLY; I do not want to use the object’s “expression”
> in the script]
>
> There is no such 4D method as   OBJECT Get Value( )     OBJECT SET VALUE( )
> If there were, we could write:
>
> OBJECT SET VALUE(*; OBJECT Get Name; Uppercase( OBJECT Get Value(Object
> Get Name) ) )  // really cumbersome, but is hypothetical because there is
> no ‘OBJECT GET / SET VALUE’ command.
>
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[hidden email]
> **********************************************************************



--
--

Peter Bozek
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

4D Tech mailing list
In reply to this post by 4D Tech mailing list
Thank you for your input.
Naturally, if the object name gets to be exactly the same as the ‘expression’ that works (IFF the value is stored in Form.[whatever] )
But when the ‘expression’ is an attribute in an entity, as I described, there is no way you can name the object like that.
I have employed the ’object name = Form. [ object name]’ methodology too. But that works in instances where it is a legal object name.

I do not understand the complexity of 4D’s internal implementation, but in the same way that you can get a pointer to a process variable, it seems you should be able to for Form.obj too (i.e. when the ‘expression’ is an attribute of some object).

— Chris


> On Feb 4, 2020, at 7:14 AM, James Crate via 4D_Tech <[hidden email]> wrote:
>
> This was annoying the first time I ran into it, but overall hasn’t really caused any serious problems for generic programming. If you name the object with the expression, you can use something like:
>
> Form[Object Get name(Object current)]:=x
>
> If you need to set properties on a form object (control) like color/disabled/etc, you can use the object name as well. The only problem is you may not be able to effectively use an object name prefix to set properties on a group of controls.
>
> I agree it would be nice if references to form controls and access to their values had been thought through a little better, but I doubt it’s likely to change now.
>
> Jim Crate
>
>
>> On Feb 3, 2020, at 10:35 PM, Chris Belanger via 4D_Tech <[hidden email]> wrote:
>>
>> What a weird ’subject’ for this question. Sorry. Seems quite confusing.
>>
>> ————
>>
>> Say that the “variable or expression” for a on-screen object is     Form.LB.Browser.en_edit.FirstName
>> This is entirely reasonable, as 4D’s ORDA has taught us to use such ‘expressions’ for the fields
>>
>> BUT in the script for this, there is no way to use Self (as there would be if it was a 4D variable) because it is an ATTRIBUTE of an object.
>>
>> This is stupid.
>> It makes it impossible to write a script as simple as:
>>
>> Self->:= Uppercase(Self->)
>>
>> Because Self returns a nil pointer.
>>
>> So how on earth do we retrieve and set the value under these circumstances? [GENERICALLY; I do not want to use the object’s “expression” in the script]
>>
>> There is no such 4D method as   OBJECT Get Value( )     OBJECT SET VALUE( )
>> If there were, we could write:
>>
>> OBJECT SET VALUE(*; OBJECT Get Name; Uppercase( OBJECT Get Value(Object Get Name) ) )  // really cumbersome, but is hypothetical because there is no ‘OBJECT GET / SET VALUE’ command.
>>
>>
>> **********************************************************************
>> 4D Internet Users Group (4D iNUG)
>> Archive:  http://lists.4d.com/archives.html
>> Options: https://lists.4d.com/mailman/options/4d_tech
>> Unsub:  mailto:[hidden email]
>> **********************************************************************
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[hidden email]
> **********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

4D Tech mailing list
In reply to this post by 4D Tech mailing list
Hi Kirk,
I appreciate how generous you are with answering questions on this forum.

I understand the 1) 2) 3) points you make. I love the fact we can ‘attach’ things to Form. Instead of using process vars. I do not use a single process var in my most recent projects.

I had to do a weird work-around when I implemented comboBoxes that I could define with parameters (and they just work).
I have a Form.cBoxes{ } object, which then contains objects that define the function of the comboBox.
Form.cBoxes[objectName].storeLoc is set to the ‘full path name’ to the attribute, such as "Form.en_edit.contact"

// The ‘field’ that needed to be updated with the KEY of the selected option would be something like: //
Form.en_edit.contact   // which, say, translates to [Company]contact in classic 4D

When I had done something similar in classic 4D, I could key a pointer to [Company]contact and update it with something like:   CompanyContact->:= $value
But with the key being stored in Form.en_edit.contact, there was no way to do something similar.

So I had to resort to creating a FORMULA OBJECT that gets executed to do the update of the .storeLoc

$formula:=Formula from string($storeLoc+":="+Qu ($UUID))  // $storeLoc is the full ‘path’ of the attribute, such as    Form.en_edit.contact
                                                                                                                // $UUID is the value that needs to be put into that attribute (i.e. field)
$formula.call()  // ...this updates it into the entity’s attribute  

Seems cumbersome to need to go about it that way, but it was the only way I could find to accomplish it. But at least it worked.

The complexity is that when I define the comboBox specs, the storeLoc must be text, like “Form.en_edit.contact"

Seems counter-intuitive to need to resort to a similar mechanism just to coerce a way to update a value of a form object (i.e. a ‘variable’ on a form).

Chris

————

> On Feb 4, 2020, at 7:57 AM, Kirk Brooks via 4D_Tech <[hidden email]> wrote:
>
> Chris,
> For a listbox the equivalent of 'self' is the Current Item Datasource.
> Let's say that is Form.LB.currentItem in keeping with your example. (It
> could be something else just as well.) This is the object that corresponds
> to the listbox row generally speaking. So you could have a method that
> validates and formats the whole object that you pass that object to.
>
> If it's a big object and this would take noticeable time or you need to do
> something more elaborate like lookups you can know still use the row and
> column (LISTBOX GET CELL POSITION) to work out what's changed.
>
> The object script has access to This. So you could use
> This.FirstName:=Uppercase(This.FirstName) in the column script.
>
> When using ORDA on a form keep in mind changing the data is what we want to
> do. The display will update itself if you are using Expressions.
>
> Let's say I have an Input I want to capitalize instead of a listbox column.
> Let's say Form.myInput is the expression and the input object is named
> InputObject. When the user changes the data I have options:
>
> 1) Self->:= Uppercase(Self->)
>
> 2) Object get pointer(Object named;"InputObject")->:=Uppercase(Object get
> pointer(Object named;"InputObject")->)
>
> 3) Form.myInput:=Uppercase(Form.myInput)
>
> #1 is the old-school approach. Simple but opaque (what exactly is Self
> pointing at?)
> #2 is the newer-school approach taking advantage of dynamic variables.
> Better sense of what is being operated on.
> #3 simply updates the property value directly. Completely transparent about
> what we are acting on.
>
> #1 and #2 are manipulating the input object which then updates Form.myInput
> whereas #3 simply updates Form.myInput directly and then the form input
> updates itself to reflect that.
>
> Hope this helps.
>
>
> On Mon, Feb 3, 2020 at 7:35 PM Chris Belanger via 4D_Tech <
> [hidden email]> wrote:
>
>> What a weird ’subject’ for this question. Sorry. Seems quite confusing.
>>
>> ————
>>
>> Say that the “variable or expression” for a on-screen object is
>> Form.LB.Browser.en_edit.FirstName
>> This is entirely reasonable, as 4D’s ORDA has taught us to use such
>> ‘expressions’ for the fields
>>
>> BUT in the script for this, there is no way to use Self (as there would be
>> if it was a 4D variable) because it is an ATTRIBUTE of an object.
>>
>> This is stupid.
>> It makes it impossible to write a script as simple as:
>>
>> Self->:= Uppercase(Self->)
>>
>> Because Self returns a nil pointer.
>>
>> So how on earth do we retrieve and set the value under these
>> circumstances? [GENERICALLY; I do not want to use the object’s “expression”
>> in the script]
>>
>> There is no such 4D method as   OBJECT Get Value( )     OBJECT SET VALUE( )
>> If there were, we could write:
>>
>> OBJECT SET VALUE(*; OBJECT Get Name; Uppercase( OBJECT Get Value(Object
>> Get Name) ) )  // really cumbersome, but is hypothetical because there is
>> no ‘OBJECT GET / SET VALUE’ command.

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

4D Tech mailing list
Chris,

On Tue, Feb 4, 2020 at 12:58 PM Chris Belanger via 4D_Tech <
[hidden email]> wrote:

> // The ‘field’ that needed to be updated with the KEY of the selected
> option would be something like: //
> Form.en_edit.contact   // which, say, translates to [Company]contact in
> classic 4D
>
> When I had done something similar in classic 4D, I could key a pointer to
> [Company]contact and update it with something like:   CompanyContact->:=
> $value
> But with the key being stored in Form.en_edit.contact, there was no way to
> do something similar.
>
I must not be following you. Why wouldn't

Form.en_edit.contact:=$value

work?

--
Kirk Brooks
San Francisco, CA
=======================
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

4D Tech mailing list
if I may interject, the O.P. was asking for generic coding,
where the object method does not know its data source expression.

but in my opinion (yes it is an opinion, not doctrine)

it is better to plan well and hard-code in ORDA,
generic coding does not deliver like it does for the classic language.

2020/02/05 9:40、Kirk Brooks via 4D_Tech <[hidden email]<mailto:[hidden email]>>のメール:
I must not be following you. Why wouldn't
Form.en_edit.contact:=$value


**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

4D Tech mailing list
In reply to this post by 4D Tech mailing list
Chris,

Is it not just:
Object get pointer(Object current)->:=Uppercase(Object get
pointer(Object current)->)

Regards,  Dougie
________________________________________________________

telekinetix Limited- J. Douglas Cryer
Phone : 01234 761759  Mobile : 07973 675 218
2nd Floor Broadway House, 4-6 The Broadway, Bedford MK40 2TE
Email : [hidden email]  Web : http://www.telekinetix.com <http://www.telekinetix.com/>
________________________________________________________
 




**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

4D Tech mailing list
Hello,

Object get pointer(Object current)->

is synonymous to Self,

and likewise it will point to nothing if the current object is not bound to a variable.

I think this is a strong sign that in object based design,
pointers are very rarely needed, if at all,
and that this kind of generic code (implicit dependency on data source)
is probably a bad idea.

you can have some generic code to construct an object path, of course,
but I think the variable factor should be a parameter or a value derived from local code.




> On Feb 5, 2020, at 17:27, Douglas Cryer via 4D_Tech <[hidden email]> wrote:
> Object get pointer(Object current)->:=Uppercase(Object get
> pointer(Object current)->)

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

4D Tech mailing list
It’s not so much that the pointer is not needed, but that it isn’t available so we have to figure out other ways to work around that fact when pointers would be more useful and allow you to write less brittle code.

Having to specify almost the same text for the name as for the expression, or reference the expression from the object script is brittle, and there’s no compiler help to make sure you got it all correct.

What would be nice is the ability to have a pointer to the form control, and the ability to get/set the value using that reference (including updating the value in the bound expression). Sure, we can get by without it, just as we were able to get by without a built-in Form object and direct object property binding.

Jim Crate


> On Feb 5, 2020, at 3:43 AM, Keisuke Miyako via 4D_Tech <[hidden email]> wrote:
>
> Hello,
>
> Object get pointer(Object current)->
>
> is synonymous to Self,
>
> and likewise it will point to nothing if the current object is not bound to a variable.
>
> I think this is a strong sign that in object based design,
> pointers are very rarely needed, if at all,
> and that this kind of generic code (implicit dependency on data source)
> is probably a bad idea.
>
> you can have some generic code to construct an object path, of course,
> but I think the variable factor should be a parameter or a value derived from local code.

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

4D Tech mailing list
In reply to this post by 4D Tech mailing list
On Tue, Feb 4, 2020 at 9:58 PM Chris Belanger via 4D_Tech <
[hidden email]> wrote:

>
> So I had to resort to creating a FORMULA OBJECT that gets executed to do
> the update of the .storeLoc
>
> $formula:=Formula from string($storeLoc+":="+Qu ($UUID))  // $storeLoc is
> the full ‘path’ of the attribute, such as    Form.en_edit.contact
>
>                                       // $UUID is the value that needs to
> be put into that attribute (i.e. field)
> $formula.call()  // ...this updates it into the entity’s attribute
>
> Seems cumbersome to need to go about it that way, but it was the only way
> I could find to accomplish it. But at least it worked.
>

Another possibility - I have not tested it, so I am not 100% sure it would
work - would be not to assign  Form property to object, and rather leave
the expression empty. Then you would have Self-> and could get pointer to
object with OBJECT Get pointer (object named;) call.

However, you would have to bind the object to the form property yourself,
with code like

case of
  :((form event=on load) | (form event=on outside call))
     Self->:=Form.en_edit.contact
  :(form event=on data change)
      Form.en_edit.contact:=Self->
end case

Peter Bozek


> The complexity is that when I define the comboBox specs, the storeLoc must
> be text, like “Form.en_edit.contact"
>
> Seems counter-intuitive to need to resort to a similar mechanism just to
> coerce a way to update a value of a form object (i.e. a ‘variable’ on a
> form).
>
> Chris
>
>
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

4D Tech mailing list
Just a little modification from Peter's code

Instead of defining an object attribute in the Variable and Expression, leave it blank so 4D will generate a dynamic variable for it. In the object method, you just need to execute the following when the On Data Change occurs.

Case of
   : (FORM Event=On Data Change)
      Form.en_edit.contact:=Self->
End case

HTH,
Add




On 2-5-20, 9:50 AM, "4D_Tech on behalf of Peter Bozek via 4D_Tech" <[hidden email] on behalf of [hidden email]> wrote:

    On Tue, Feb 4, 2020 at 9:58 PM Chris Belanger via 4D_Tech <
    [hidden email]> wrote:

    >
    > So I had to resort to creating a FORMULA OBJECT that gets executed to do
    > the update of the .storeLoc
    >
    > $formula:=Formula from string($storeLoc+":="+Qu ($UUID))  // $storeLoc is
    > the full ‘path’ of the attribute, such as    Form.en_edit.contact
    >
    >                                       // $UUID is the value that needs to
    > be put into that attribute (i.e. field)
    > $formula.call()  // ...this updates it into the entity’s attribute
    >
    > Seems cumbersome to need to go about it that way, but it was the only way
    > I could find to accomplish it. But at least it worked.
    >

    Another possibility - I have not tested it, so I am not 100% sure it would
    work - would be not to assign  Form property to object, and rather leave
    the expression empty. Then you would have Self-> and could get pointer to
    object with OBJECT Get pointer (object named;) call.

    However, you would have to bind the object to the form property yourself,
    with code like

    case of
      :((form event=on load) | (form event=on outside call))
         Self->:=Form.en_edit.contact
      :(form event=on data change)
          Form.en_edit.contact:=Self->
    end case

    Peter Bozek


    > The complexity is that when I define the comboBox specs, the storeLoc must
    > be text, like “Form.en_edit.contact"
    >
    > Seems counter-intuitive to need to resort to a similar mechanism just to
    > coerce a way to update a value of a form object (i.e. a ‘variable’ on a
    > form).
    >
    > Chris
    >
    >
    **********************************************************************
    4D Internet Users Group (4D iNUG)
    Archive:  http://lists.4d.com/archives.html
    Options: https://lists.4d.com/mailman/options/4d_tech
    Unsub:  mailto:[hidden email]
    **********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

4D Tech mailing list
On Wed, Feb 5, 2020 at 7:04 PM Add Komoncharoensiri via 4D_Tech <
[hidden email]> wrote:

> Just a little modification from Peter's code
>
> Instead of defining an object attribute in the Variable and Expression,
> leave it blank so 4D will generate a dynamic variable for it. In the object
> method, you just need to execute the following when the On Data Change
> occurs.
>
> Case of
>    : (FORM Event=On Data Change)
>       Form.en_edit.contact:=Self->
> End case
>
>
The second part of my code deal with initialisation of dynamic variable
from Form.en_edit.contact.

Peter Bozek
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?

4D Tech mailing list
Ah yes, sorry I skimmed too fast.

Add



From: Peter Bozek <[hidden email]>
Date: Wednesday, February 5, 2020 at 11:10 AM
To: iNug <[hidden email]>
Cc: Add Komoncharoensiri <[hidden email]>
Subject: Re: What is equivalent to SELF when a form object's "variable or expression" is an object attribute?



On Wed, Feb 5, 2020 at 7:04 PM Add Komoncharoensiri via 4D_Tech <[hidden email]<mailto:[hidden email]>> wrote:
Just a little modification from Peter's code

Instead of defining an object attribute in the Variable and Expression, leave it blank so 4D will generate a dynamic variable for it. In the object method, you just need to execute the following when the On Data Change occurs.

Case of
   : (FORM Event=On Data Change)
      Form.en_edit.contact:=Self->
End case

The second part of my code deal with initialisation of dynamic variable from Form.en_edit.contact.

Peter Bozek
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************