Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
db_transform
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vaclab
db_transform
Commits
ad0d235a
Commit
ad0d235a
authored
9 years ago
by
wactbprot
Browse files
Options
Downloads
Patches
Plain Diff
customer Adress --> address
parent
afe8338c
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
shift-cal.r
+14
-10
14 additions, 10 deletions
shift-cal.r
shift-cus.r
+7
-5
7 additions, 5 deletions
shift-cus.r
shows/calibration.js
+26
-8
26 additions, 8 deletions
shows/calibration.js
shows/todo.js
+1
-1
1 addition, 1 deletion
shows/todo.js
with
48 additions
and
24 deletions
shift-cal.r
+
14
−
10
View file @
ad0d235a
...
...
@@ -5,7 +5,7 @@ cin <- cdbIni()
cin
$
DBName
<-
"vaclab_db"
cin
$
view
<-
"cal"
cin
$
design
<-
"new"
cin
$
show
<-
"calibration"
## out
cout
<-
cdbIni
()
cout
$
DBName
<-
"vl_db"
...
...
@@ -14,16 +14,20 @@ ids <- cdbGetView(cin)$res$rows
N
<-
length
(
ids
)
for
(
i
in
1
:
N
){
pf
<-
cin
$
fromJSON
(
getURL
(
paste0
(
srv
,
cin
$
DBName
,
"/_design/"
,
cin
$
design
,
"/_show/calibration/"
,
ids
[[
i
]]
$
id
)))
cout
$
id
<-
ids
[[
i
]]
$
key
$
new_id
# secure is secure
cin
$
id
<-
ids
[[
i
]]
$
id
pf
<-
cdbGetShow
(
cin
)
$
res
cout
$
id
<-
ids
[[
i
]]
$
key
$
new_id
## secure is secure
pf
$
old_id
<-
ids
[[
i
]]
$
id
cout
$
dataList
<-
pf
res
<-
cdbUpdateDoc
(
cout
)
res
<-
cdbUpdateDoc
(
cout
)
$
res
print
(
res
)
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
shift-cus.r
+
7
−
5
View file @
ad0d235a
...
...
@@ -3,13 +3,13 @@ library("R4CouchDB")
## in
cin
<-
cdbIni
()
cin
$
DBName
<-
"v
aclab
_db"
cin
$
DBName
<-
"v
l
_db"
cin
$
view
<-
"cus"
cin
$
design
<-
"
new
"
cin
$
design
<-
"
hlp
"
## out
cout
<-
cdbIni
()
cout
$
DBName
<-
"
vl
_db"
cout
$
DBName
<-
"
tst
_db"
ids
<-
cdbGetView
(
cin
)
$
res
$
rows
N
<-
length
(
ids
)
...
...
@@ -17,8 +17,10 @@ N <- length(ids)
for
(
i
in
1
:
N
){
cin
$
id
<-
ids
[[
i
]]
$
id
pf
<-
cdbGetDoc
(
cin
)
$
res
cout
$
id
<-
ids
[[
i
]]
$
key
$
new_id
# cout$id <-ids[[i]]$key$new_id
pf
$
Customer
$
Address
<-
pf
$
Customer
$
Adress
pf
$
Customer
$
Adress
<-
NULL
cout
$
id
<-
cin
$
id
cout
$
dataList
<-
pf
res
<-
cdbUpdateDoc
(
cout
)
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
shows/calibration.js
+
26
−
8
View file @
ad0d235a
...
...
@@ -8,20 +8,28 @@ function (doc, req) {
doc
.
Calibration
.
Standard
){
var
dc
=
doc
.
Calibration
;
// certificate & issue
var
ssign
=
dc
.
Sign
.
split
(
/
[
-_
]
/
)
,
cert
=
ssign
[
0
]
,
issue
=
ssign
[
1
]
// new
// new
id
ndoc
[
"
_id
"
]
=
[
"
cal
"
,
dc
.
Year
,
dc
.
Standard
,
dc
.
Type
.
toLowerCase
()
,
dc
.
Sign
].
join
(
"
-
"
)
,
cert
,
issue
].
join
(
"
-
"
)
ndoc
.
Calibration
=
{};
ndoc
.
Calibration
.
Year
=
dc
.
Year
ndoc
.
Calibration
.
Type
=
dc
.
Type
ndoc
.
Calibration
.
Sign
=
dc
.
Sign
ndoc
.
Calibration
.
Standard
=
dc
.
Standard
ndoc
.
Calibration
.
Year
=
dc
.
Year
ndoc
.
Calibration
.
Type
=
dc
.
Type
//
ndoc
.
Calibration
.
Certificate
=
cert
ndoc
.
Calibration
.
Issue
=
issue
ndoc
.
Calibration
.
Standard
=
dc
.
Standard
if
(
dc
.
Measurement
){
var
dcm
=
dc
.
Measurement
;
...
...
@@ -69,7 +77,17 @@ function (doc, req) {
}
// new
if
(
dcm
.
CalibrationObject
){
ndoc
.
Calibration
.
CalibrationObject
=
dcm
.
CalibrationObject
;
var
N
=
dcm
.
CalibrationObject
.
length
;
if
(
N
==
1
){
ndoc
.
Calibration
.
CustomerObject
=
dcm
.
CalibrationObject
[
0
];
}
if
(
N
>
1
){
ndoc
.
Calibration
.
CustomerObject
=
dcm
.
CalibrationObject
[
0
];
ndoc
.
Calibration
.
CalibrationObject
=
[];
for
(
var
j
=
1
;
j
<
N
;
j
++
){
ndoc
.
Calibration
.
CalibrationObject
.
push
(
dcm
.
CalibrationObject
[
j
])
}
}
}
// new
if
(
dcm
.
Standard
){
...
...
@@ -93,7 +111,7 @@ function (doc, req) {
}
return
{
"
headers
"
:
{
"
Content-Type
"
:
"
application/json
"
},
"
headers
"
:
{
"
Content-Type
"
:
"
application/json
; charset=utf-8
"
},
"
body
"
:
JSON
.
stringify
(
ndoc
)
}
};
This diff is collapsed.
Click to expand it.
shows/todo.js
+
1
−
1
View file @
ad0d235a
...
...
@@ -38,7 +38,7 @@ function (doc, req) {
}
return
{
"
headers
"
:
{
"
Content-Type
"
:
"
application/json
"
},
"
headers
"
:
{
"
Content-Type
"
:
"
application/json
; charset=utf-8
"
},
"
body
"
:
JSON
.
stringify
(
ndoc
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment