copy (object)

object for multiselect, multidelete, multicopy, export and import from clipboard

 

Example call function

in openevent:

dw_1.multiselect=true

 

copy

object=ue_copy=copy=beas_pk_schema,beas_pk_typen=schema_id

 

Insert

destroy=lcopy

declare=lcopy=ue_copy

lcopy=setprimarykey=schema_id

lcopy=setincrementfield=beas_pk_typen=buchnr_id

lcopy=insertclipboard=beas_pk_schema,beas_pk_typen

 

cut

if <rowcount> n= 0 then

 return success

end if

destroy=lcopy

declare=lcopy=ue_copy

lcopy=checktable=beas_ftpos

lcopy=setprimary=schema_id

lcopy=cut=beas_pk_schema,beas_pk_typen

if <value> n= -1 then

 return failure

endif

destroy=lcopy

meldung=ok$ok

retrieve=retrieve

 

Methodes

the master-functions are

cut, copy and insertclipboard

 

cut=[dw_x=]tablelist

cut all select entrys. table=the master- and reference-table.

- check, if beas can delete the entry in the reference-tables

- copy to the clipboard

- delete the entrys

you can use this for a delete-function with undo-function.

you can set the check-tables with "checktable", the primary with "primarykey" and the reference-table with "setreference"

if you've more then one primary, set the other primarys with "setadditionalprimarykey"

copy=[dw_x=]tablelist

the same as cut, but without dekete entrys

checktable=<propertie>

Add Information to checktable and call the check-function:

Check in all related table, if the entry if exist

You can call this funktion to check, if the entry is exist in other tables.

 

 

reset

Reset all information

select count(*) from ...

sql-statement for check a table. the primary-value is in [primaryfield], example

... where itemcode=N'[primaryfield]'

beas will replace this placeholder with the selected primaryfield

table1,table2...

set the related tables with the primary-key from the default window

example:

beas_pk_schema,beas_pk_typen

generate follow sql-statement

select count(*) from beas_pk_schema where schema_id=N'[primarykey]'

 

table1:primary

the ":primary" is the primary of this table. Use this, if you havn't an primary-field in your current window or the table have an other primary-field-name

check

return true, if no reference-information exists

and in variable "value"

1=no entry found

-1=entry found

and in "valuetable" the select-command



 

 

setreference

set reference-tables for cut and delete

lcopy=setadditionalprimarykey=otherprimary

lcopy=setreference=tablename1,tablename2...

lcopy=setreference=tablename1:primarykeyname,...

lcopy=setreference=delete from ... where key='[primarykey]'

More Information see checktable-Function

Attention: set this command behind "setadditionalprimarykey"

setprimarykey

set the name of the primary-field

createstring=table1,table2..=primarykey=valuesqlstring

generate a binary data-String in variable sys_copystring about the tables

tablex  the table-list to copy

valuestring the values in format 'value1','value2'

 

Example

dw_1.multiselect=1

object=ue_copy=createstring=beas_me=me_id=<dw_1.getselectentrysql>

 

Example Calculation-Schema

dw_1.multiselect=1

object=ue_copy=createstring=beas_pk_scchema,beas_pk_typen=schema_id=<dw_1.getselectentrysql>

setadditionalprimarykey=key=value

set additional primarykey, example the workordernumber if you copy a workorderposition. You can set more then one

lcopy=setadditionalprimarykey=belnr_id=<belnr_id>

and you can set more then one additional key with a second line

lcopy=setadditionalprimarykey=key1=value

lcopy=setadditionalprimarykey=key2=value

Attention: set this command before "setreference"

setadditionalinfo

Set additionainfo in exportstring. Write this info in [additionalinfo=<your info>]

example: Check that you can only insert the string, if the additionalinfo the same

Import: set this info in the same way

 

Import

insertclipboard=[table]

insert from clipboard, the tablelist must be same as in the clipboard

insertfrombuffer=[table]

insert from current ids-buffer

setdatafromclipboard

For Import: set importstring from Clipboard

setdata=<string>

For Import: set importstring directly

lcopy=setdata=<mystring>

setvaluekeys

read string sys_copy_info (created by replacewindow) and build arrays for handle the this function is calling automatically in "copyfromdis",

lcopy=setvaluekeys

setincrementfield=table:field

set a primaryfield for this table as a primary count field

this field will be set with a identity key-value (only integer-type)

example:

lcopy=setincrementfield=beas_pk_typen=buchnr_id

 

getldsfromstring

works only with importstring-data

set this string with setdatafromclipboard or setdata

check=<table>

check if the table exist as datastores in the string

return in value. Error: the table, ok: empty String

example:

lcopy=setdatafromclipboard

lcopy=check=beas_pk_haupt,beas_pk_pos

if <value> <> then

  messagebox=error$$can't import the &

       data from clipboard. Error Table <value>

  return failure

end if

<table>

extract table from datastring and save this in the lcopy.ids - DataStore

 

copyfromids=<table[:key]>

copy from lcopy.ids to the table with the primarykey ":key" or the primarykey, set with "setprimarykey" or the current primarykey from current window.

before copy

1. create Variable sys_copy_info (with replacewindow)

2. create copy-Info with ....

 

sendretrieve=true/false

send a retrieve-command after insert. default = true

replacewindow (object)

Sub-Object replacewindow: for all command for the insert/replace-window system_copy_edit.psr

load

Load all Entrys from str_parm.

s_parm2  the name of copy-object in the parent window  

s_parm1  the command to call after update

all other information will be get from parent window

save

read entrys from dw_2 and save this in the parent window in variable sys_copy_info

oldprimaryid[9]replacetype[9]newprimaryid[13/10]

replacetype:

i=ignore, r=replace, n=new

checktype

check the last change in replacetype. You can set only to "replace", if the entry exists...

checknewprimary

check the new primary-id. check if the entry exists and if not duplicate in the current list

 

 

 

Format of Copy-DataString

[beasclipboard]

Sign of generate String from beas

[tables=...]

the tables: table1,table2

[values=...]

the values: 'value1','value2',...

[user=...]

the current user

[station=...]

the station-Name

[timestamp=...]

time stamp in format yyyy/mm/dd hh:mm:ss

[beas-version=..]

generate with beas-version...

[window=..]

Filename from current window

[table=<tablename>] ...

[/table=<tablename>]

the datastore (psr-file) from the data as ascii-zipped-data-String

[primaryfield=<primary>]

the primary-field