Write to xml file

borhane

Member
hello
how can I assign data outside xml file predefined by a backoffice program openedge 10.2b


example ABL : assign product_code and designation under xml file.

example:
<keyboard key-label="TAB" shift-key="false" ctrl-key="false" alt-key="false" key-value="{TAB}" layer="1" row="1" pos="1">
<special-lKey/>
<key-value-Literal/>
<width>91</width>
<height>77</height>
<indent>0</indent>
<sensitive>true</sensitive>
<image-Up>D:\CAMELEON\Icones\tabx.png</image-Up>
<image-dwn>D:\CAMELEON\Icones\tabx.png</image-dwn>

</keyboard>
 

TomBascom

Curmudgeon
I don’t really understand what you are asking for. Could you elaborate? Maybe show some pseudo code illustrating what you are hoping to achieve?
 

borhane

Member
I don’t really understand what you are asking for. Could you elaborate? Maybe show some pseudo code illustrating what you are hoping to achieve?
hello ;
it is a predefined xml code to create a button I want to modify the fields of this code by an abl program
example :
key-label= label and key-value= code
 

Cecil

19+ years progress programming and still learning.
This looks like my dynamic visual keyboard code.

import the xml into a temp table. manipulate the temp-table and write back to file.

if you need to do this from a back office machine that updates the POS machine, this can be done a few ways.

The simplest way without intro introducing new technologies is to store the xml into a CLOB field on the Backoffice machine. The POS will connect to the Backoffice database and extract the XML from the CLOB field. Recommendation is to use dynamic queries to help avoid CRC issues.

If you are using appserver, that would be even better. POS client connects to the Backoffice machine via AppServer aND pulls back the longchar
(CLOB) of the xml, then write is back to file.

Or insisted of have the xml keyboard config files stored in the XML , have them stored in the DB on the POS.
 

Stefan

Well-Known Member
This should get you started:
Code:
define temp-table tt serialize-name 'keyboard'
    field ckey_label as char serialize-name 'key-label' xml-node-type 'attribute'
    field ckey_value as char serialize-name 'key-value' xml-node-type 'attribute'

    field special-lKey as char    
    field cimage_up as char serialize-name 'image-Up'
    .

define dataset ds serialize-hidden
    for tt
    .

def var lcxml as longchar.

dataset ds:read-xml( 'file', 'keyboard.xml', ?, ?, ? ).

dataset ds:write-xml( 'longchar', lcxml, true ).

message 'before:' skip(1) string( lcxml ) skip(2).

find tt.
assign 
    tt.ckey_label = 'label'
    tt.ckey_value = 'code'
    .

dataset ds:write-xml( 'longchar', lcxml, true ).

message 'after:' skip(1) string( lcxml ).

 

Cecil

19+ years progress programming and still learning.
Digging though my code I found this.

Code:
DEFINE TEMP-TABLE keyboardLayer NO-UNDO SERIALIZE-NAME "keyboardLayer"
    FIELD Layer        AS INTEGER SERIALIZE-NAME "layer"        XML-NODE-TYPE "ATTRIBUTE"
    FIELD keyboardDesc AS CHARACTER SERIALIZE-NAME "keyboard-desc".

DEFINE TEMP-TABLE keyboard NO-UNDO SERIALIZE-NAME "keyboard"
    FIELD KeyCaption  AS CHARACTER SERIALIZE-NAME "key-label"  XML-NODE-TYPE "ATTRIBUTE"
    FIELD keyValue    AS CHARACTER CASE-SENSITIVE SERIALIZE-NAME "key-value"  XML-NODE-TYPE "ATTRIBUTE"
    FIELD shiftKey    AS LOGICAL SERIALIZE-NAME "shift-key"    XML-NODE-TYPE "ATTRIBUTE"
    FIELD ctrlKey     AS LOGICAL SERIALIZE-NAME "ctrl-key"    XML-NODE-TYPE "ATTRIBUTE"
    FIELD altKey      AS LOGICAL SERIALIZE-NAME "alt-key"    XML-NODE-TYPE "ATTRIBUTE"
    FIELD Layer       AS INTEGER SERIALIZE-NAME "layer"        XML-NODE-TYPE "HIDDEN"
    FIELD KeyboardRow AS INTEGER SERIALIZE-NAME "row"          XML-NODE-TYPE "ATTRIBUTE"
    FIELD KeyboardPos AS INTEGER SERIALIZE-NAME "pos"          XML-NODE-TYPE "ATTRIBUTE"
    FIELD KeyWidth    AS INTEGER SERIALIZE-NAME "width"
    FIELD KeyHeight   AS INTEGER SERIALIZE-NAME "height"
    FIELD indent      AS INTEGER SERIALIZE-NAME "indent"  
    FIELD SENSITIVE   AS LOGICAL SERIALIZE-NAME "sensitive"  INITIAL TRUE
    FIELD imageUp     AS CHARACTER SERIALIZE-NAME "image-up"
    FIELD imageDown   AS CHARACTER SERIALIZE-NAME "image-dwn"
    FIELD WIDGET-HANDLE   AS HANDLE XML-NODE-TYPE "HIDDEN"
    INDEX idxPosition IS PRIMARY
        Layer
        KeyboardRow
        KeyboardPos.
       
/* DEFINE TEMP-TABLE layer1 SERIALIZE-NAME "keyboard" LIKE  keyboard .  */
/* DEFINE TEMP-TABLE layer2 SERIALIZE-NAME "keyboard" LIKE  keyboard  . */
/* DEFINE TEMP-TABLE layer3 SERIALIZE-NAME "keyboard" LIKE  keyboard.   */
/* DEFINE TEMP-TABLE layer4 SERIALIZE-NAME "keyboard" LIKE  keyboard .  */


    DEFINE DATASET keyboardLayout SERIALIZE-NAME "keyboardLayout" FOR keyboardLayer, keyboard DATA-RELATION FOR keyboardLayer, keyboard RELATION-FIELDS(Layer, Layer) NESTED.

Source Code:
 
Last edited:

borhane

Member
This looks like my dynamic visual keyboard code.

import the xml into a temp table. manipulate the temp-table and write back to file.

if you need to do this from a back office machine that updates the POS machine, this can be done a few ways.

The simplest way without intro introducing new technologies is to store the xml into a CLOB field on the Backoffice machine. The POS will connect to the Backoffice database and extract the XML from the CLOB field. Recommendation is to use dynamic queries to help avoid CRC issues.

If you are using appserver, that would be even better. POS client connects to the Backoffice machine via AppServer aND pulls back the longchar
(CLOB) of the xml, then write is back to file.

Or insisted of have the xml keyboard config files stored in the XML , have them stored in the DB on the POS.
Hello Cecil I confirm that the code in question is good
yours I ask you for more detail to provide a code that will be manipulated by the user
 

borhane

Member
Digging though my code I found this.



Source Code:

I already have this code and I want to modify the xml file by a code ABL in short I want to manage my buttons without entering the xml file. example: I have a product sheet that contains an article code and label when I check a box I have to update the predefined xml file of the buttons
 

Stefan

Well-Known Member
I already have this code and I want to modify the xml file by a code ABL in short I want to manage my buttons without entering the xml file. example: I have a product sheet that contains an article code and label when I check a box I have to update the predefined xml file of the buttons
And which part of my reply, which did update the XML using ABL, was unclear?
 

Cecil

19+ years progress programming and still learning.
I already have this code and I want to modify the xml file by a code ABL in short I want to manage my buttons without entering the xml file. example: I have a product sheet that contains an article code and label when I check a box I have to update the predefined xml file of the buttons
It sound like you want a visual button maintenance editor which will regenerate the XML.
 

Cecil

19+ years progress programming and still learning.
I started looking at developing a WYSIWYG editor to manipulate the buttons (resize, position, caption/label, images etc. ) and to save to XML . But this would take a bit of time to develop.

I could look a developing a simpler GUI tool to have an updatable browser which edits the temp-table and then writes back to the XML file. At the moment it's just trying to find the time.
 

borhane

Member
I started looking at developing a WYSIWYG editor to manipulate the buttons (resize, position, caption/label, images etc. ) and to save to XML . But this would take a bit of time to develop.

I could look a developing a simpler GUI tool to have an updatable browser which edits the temp-table and then writes back to the XML file. At the moment it's just trying to find the time.
Thank you very much for your sincere collaboration I await your return
 
Top