Kirk:

The code below is used to populate dynamic variables with data coming in
from SAP via XML:


*C_LONGINT*($index_L)

*For *($index_L;1;*OT_SizeOfArray *
($orderListHandle_L;"$orderDetailObjectNames_AT"))


*     C_TEXT*($objectName_T)

     $objectName_T:=*OT_GetArrayText *
($orderListHandle_L;"$orderDetailObjectNames_AT";$index_L)



     *C_TEXT*($tag_T)

     $tag_T:=*OT_GetArrayText *
($orderListHandle_L;"$orderObjectTagNames_AT";$index_L)


     (*OBJ_GPBN *($objectName_T))->:=*OB Get*($orderHeaderDetail_O;$tag_T;
*Type*(*OBJ_GPBN *($objectName_T)->))


*End for *




The OT_ methods are wrapper routines for Object Tools and OBJ_GPBN is a
wrapper for Object get pointer(Object named).


When working with OB commands or OT commands, I use wrapper routines where
possible but, in this case, I'm using the 4D command because I want to use
a very, very nice feature that 4D included in OB Get - the Type parameter.
When creating a variable on a form, dynamic or otherwise, the Type is
important because it allows us to assign a filter/format. The Type
parameter of OB Get plays right into that.


While this isn't using Process tags, "it's the same (but different)" in
that it's a way to parse incoming JSON into variables.


After the first version of this code was released, we decided to add
another value coming back from SAP. All I had to do was create a dynamic
variable with a name that matched the name coming in from SAP XML payload,
select the variable and set the Type value in the property list, and assign
a format to the dynamic variable. Next time I got data back from SAP, the
tag in the JSON matched the name of the object on the form and the variable
was populated. No code change. No bugs. *Very* bueno.


BTW, we are using code from the 4D tech note component that converts XML to
JSON - many thanks to Timothy Tse for the tech note.




--
Douglas von Roeder
949-336-2902

On Sun, Oct 30, 2016 at 12:22 PM, Lee Hinde <[email protected]> wrote:

> It feels like you'd have to use 4Deval.  But, I think I'd unpack a c_object
> with javascript once in the web page.
>
>
> On Sun, Oct 30, 2016 at 8:38 AM, Kirk Brooks <[email protected]> wrote:
>
> > I haven't used Process Tabs very much but it is promising.
> >
> > I use javaScript and jQuery to turn JSON into web pages and web areas. I
> > thought I'd look at doing this on the 4D side with process tags but I
> can't
> > find a clean way to process data from a c-object. All my solutions are
> > overly involved which makes me think I'm missing something.
> >
> > Is anyone doing this also? Could you share a few tips on how you make it
> > work?
> >
> > Thanks
> >
> > --
> > Kirk Brooks
> > San Francisco, CA
> > =======================
> >
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************
>
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to