About batch write Questions
我是 Ninox 的初学者,我的代码遇到了一些问题。我正在尝试将“1”中的信息一一写入“2”中。你能帮助我吗?提前致谢。
11 replies
-
I'm a beginner with Ninox, and I'm having some trouble with my code. I'm trying to write the information in "1" one by one into "2". Can you help me? Thanks in advance.
-
Is the data in 1 just text separated by a paragraph mark?
Is the table in 1 related to the parent table or child table in 2?
1 中的数据只是由段落标记分隔的文本吗?
1中的表与2中的父表或子表相关吗?
Hope the translation is ok. :)
-
I have attached the file. I would appreciate your help. Thank you.
-
try with this:
let t := this; let s := split(t.'文本 (多行)', " "); for item in s do let newRecord := (create Tabella); newRecord.(campo := item) end
sorry I renamed the Table and a field , I had some difficulties with characters
-
said:
I just didn't know how to use the "item" function.Just to make things clear, what francesco wrote is a for loop command.
for [loop variable] in [array] do
end
So what you referred to as the item function is just the loop variable.
Breaking down the code:
let t := this; let s := split(t.'文本 (多行)', " "); for item in s do let newRecord := (create Tabella); newRecord.(campo := item) end
Line 1, creates a variable, "t", and uses the 'this' command to get the record Id of the current record you are on. This allows you to access all fields in that record with just one variable. Handy if you need access to many fields, so you don't have to create a variable for each field you need access to.
Line 2, creates a variable, "s", and uses the split() command to take the text in the field '文本 (多行)' and create an array using the carriage return as the separator. In Ninox you don't need to know any special code for a carriage return as you can just hit the enter key and Ninox will know to look for that. Handy, but it can make the code, in my lowly opinion, hard to read at times.
Line 4: uses the for loop command to go through the array created in line 2 and:
create a new record in the Tabella table, line 5, and assigns it to a variable then
sets the field campo of the newly created record to equal the value of the for loop variable, "item" from line 4.
-
Based on the above questions, I have modified my code, and it can be written in. However, there is a new problem. How to merge these two code segments, thank you.
let aa := this; for i from 0 to sum('入库仓库'.'5_采购订单'.'入库产品明细'.'数量(整)') do let i := (create '物流码'); i.('日期' := datetime(now())); i.('产品' := first(aa.'入库产品明细'.'产品')); i.('采购入库' := aa); i.('进货单价' := first(aa.'入库产品明细'.'进货价')); i.('仓库' := aa.'入库仓库') end; let s := split(text(aa.'入库产品明细'.'物流码'), " "); for item in s do let newRecord := (create '物流码'); newRecord.('物流码' := item) end;
-
I did it!
Content aside
- Status Answered
- 1 yr agoLast active
- 11Replies
- 96Views
-
3
Following