To copy a column with a formula ?
Hi,
Can someone tell me how to copy a column with a formula ?
Thanks
31 replies
-
Hi,
Create a button in your form with this code:
for i in select YourTable do
let myCopy := i.YourColumn;
i.(YourNewColumn := myCopy)
endThis will copy all records in your table.
YourTable = Your table name
YourColumn = The field name you want to transfer
YourNewColumn = The New Column (firled name)
-
Thanks Nick
I have that alert :
"A table has not been found Ma on the line 1 column 23"
The name of the table is "Ma base"
Where is the mistake ?
-
When there is a space in the names of the tables or fields we close them in single quotes:
for i in select 'Ma base' do
let myCopy := i.YourColumn;
i.(YourNewColumn := myCopy)
end -
Thanks Nick
I tried that :
for i in select 'Ma base'do
let myCopy := i.Nom;
i.(Nom 2:= myCopy)
end
But I get the alert :
"a table has not been founded « Ma base on the line 1, column 27"
-
The problem is in the table name. Either you do not write it correctly or the quotes are not the right ones.
Make a copy of your database and change the table name to Ma_base or Mabase and try again without the quotes.
-
Thanks Nick
So I tried :
for i in select Mabase do
let myCopy := i.Nom;
i.(Nom 2:= myCopy)
end
Same alert : a table has not been founded « Ma base on the line 1, column 27"
and :
for i in select 'Mabase' do
let myCopy := i.Nom;
i.(Nom 2:= myCopy)
end
Same alert : a table has not been founded « Ma base on the line 1, column 27"
-
I write this formula in the formula area "txt" thumbnail
Not in the "visual" thumbnail.
And I did not create a button.
Could this have something to do with the error?
-
The app tells you the problem. It can't find the table Ma... (or Ma base).
Please copy (from the Edit Fields screen) and paste here the name of your Table.
-
for i in select Mabase do
let myCopy := i.Nom;
i.(Nom 2:= myCopy)
end
Same alert : a table has not been founded « Ma base on the line 1, column 27"
and :
for i in select 'Mabase' do
let myCopy := i.Nom;
i.(Nom 2:= myCopy)
end
-
Again,
Please copy (from the Edit Fields screen) and paste here the name of your Table.
-
I tried two of them :
Mabase
'Mabase'
-
I got it :
Table1
-
OK, try this:
for i in select Table1 do
let myCopy := i.Nom;
i.(Nom 2:= myCopy)
end
-
Thanks
I get :
Waited Symbol ”)” line 3 column 8
-
for i in select Table1 do
let myCopy := i.Nom;
i.('Nom 2' := myCopy)
end
-
Thanks
Now I get :
"this formula may not modify the datas"
I click on "ok" but nothing happens
-
Where do you use rhis code? This code goes to a Button.
What kind of fields are the Nom and Nom 2?
-
I can't no more put a screenshot in the forum !
It was possible before, what is the way to do it ?
-
Hi Nick
One can't no more put a screen shot on the forum for des time 0
being.
I write this script on the formula White area that opens when you click on the wrench on the form Window ans select the formula buttons
Then I click on the texte tab next to the visual tab and write
-
Okay, you write it in the formula editor, but where do you assign it?
This code will only work if assigned to a button.Create a new button and enter the code in the "On Click" box. The formula editor will open, enter your code and click OK.
-
Thank you Nick.
Sorry but can you tell me the say to create a button ?
-
Open the "Edit Fields" screen and select 'Add Layout Element" to the right and then choose "Button".
I think it is a good idea to read the manual.
-
Thank you Nick.
It works very well !
-
I have another base where I should like to remove the duplicates
May be you could help me ?
There is the script but I get an error :
"a column has not been found : Chef op_field on the line 52"
for i in select 'Tableau1-Tableau 1'.'Chef op_field' do
while cnt(select 'Tableau1-Tableau 1' where 'Chef op'= text(i))!=1 do
delete last(select 'Tableau1-Tableau 1' where .'Chef op' = text(i))
end
end␁
The field is Chef op, maybe 'Chef op_field' is not right…
Could you please telle me why there is this error ?
-
I changed 'Chef op_field' > 'Chef op'
for i in select 'Tableau1-Tableau 1'.'Chef op' do
while cnt(select 'Tableau1-Tableau 1' where 'Chef op'= text(i))!=1 do
delete last(select 'Tableau1-Tableau 1' where .'Chef op' = text(i))
end
end␁
I get the Alert "Waited expression (term ?) on lign 3 column 47"
Content aside
- 3 yrs agoLast active
- 31Replies
- 2025Views