Is their a way to copy a longtext field from one tabel to an other tabel so that I can edit the field in the new table?
The easiest way would be to make a selection in a enum column, and the corresponding longtext field would be copied to the next column. Than i could edit the copy text.
It seems like you do not care about keeping the data in-sync? not sure your exact use case, but if you want to duplicate a column in another table and be able to edit it, I think you may need to consider using an Action button to do that. Since the column is in another table, have to see if actions can specify a column in another table (I have not tried this yet). There is an app demoโg how to use โRef Actionsโ that effect another table so might want to check this out: App Demo: Reference Actions
Create a child table, and use dereferences to retrieve the longtext from the parent table. Set the formula on the initial value, and you can edit the long text in the child entry
Nice! Now you have two options!!
Easy enough. Set the initial value expression for the target column (the LongText column to receive the copied text) to:
LOOKUP([_THISROW].[SourceChoice], "SourceTable", "SourceName", "SourceText")
replacing SourceChoice
with the name of the Enum column containing the userโs choice; SourceTable
with the name of the table containing the original text; SourceName
with the name of the column in SourceTable that contains the Enum values matching the one chosen by he user for SourceChoice; and SourceText
with the name of the LongText column in SourceTable that contains the text to copy.
The above will populate the column value with the chosen source text from the source tableโbut will only do so when the row is first created: once the new row is saved, changes to SourceChoice in future row edits through a form will not change the copied text.
Also note that changing the SourceChoice value will only update the target text so long as the user does not edit the copied text. Once the user edits the text, a change to SourceChoice will not change the target columnโs value.
See also: LOOKUP()
Read more:
Even better details from @Steve โฆ use Initial Value first time around, and later edits can override. Always multiple ways to get the job done
@Steve: another syntax questionโฆ
why in the LOOKUP do we sometimes use column names between brackets ([colnam]) and other times in quotes? I am always feeling things are a bit inconsistent. What am I missing?
LOOKUP([SourceChoice], โSourceTableโ, โSourceNameโ, โSourceTextโ)
Also, why use Lookup vs the DeRef @Jeremy_F suggested? Seems like if the tables are related by key, then the DeRef is automatically available?
Brackets: an expression to be evaluated to produce an intended value.
No brackets: a name to be taken literally and used as-is.
LOOKUP([SourceChoice], โSourceTableโ, โSourceNameโ, โSourceTextโ)
[SourceChoice]
is an expression that evaluates to theโoops. Need to correct a mistakeโฆLetโs try this againโฆ
LOOKUP([_THISROW].[SourceChoice], "SourceTable", "SourceName", "SourceText")
[_THISROW].[SourceChoice]
is an expression that evaluates to the value in the SourceChoice column of the row referenced by the _THISROW (pseudo-)column. The first argument of LOOKUP() is taken as an expression to be evaluated for each row in SourceTable. If the first argument were just SourceChoice
(i.e., LOOKUP(SourceChoice, ...)
or LOOKUP("SourceChoice", ...)
), LOOKUP() would look for the literal text, โSourceChoiceโ, not the current value of the SourceChoice column.
SourceTable
is the name of a table to look in and cannot be an expression.
SourceName
is the name of the column of SourceTable in which to look for the value produced by the expression in the first argument. It cannot be an expression.
SourceText
is the name of the column in SourceText whose value should be returned if a match is found. This, too, cannot be an expression.
It may also help to consider the LOOKUP() and equivalent SELECT() expressions:
LOOKUP([_THISROW].[SourceChoice], "SourceTable", "SourceName", "SourceText")
ANY(SELECT(SourceTable[SourceText], ([SourceName] = [_THISROW].[SourceChoice])))
In the SELECT() expression, you would not be allowed to use expressions in place of SourceTable
, SourceText
, or SourceName
. Likewise in LOOKUP().
@Steve - thanks for taking the time.
maybe itโs just me (and the way the syntax is listed in the help docs).
Syntax
LOOKUP( find-value , in-dataset , in-column , return-column )
when I read โin-columnโ I am not thinking in-column-named, I am thinking in-column.
soโฆ I would first think
LOOKUP([column with the value I want to find],โtablenameโ,[ColToSearchIn], [ColToReturn])
when it actually needs to:
LOOKUP([column with the value I want to find],โtablenameโ,โColToSearchInโ, [ColToReturn])
And it seems odd to me that in-column and return-column do not have the same syntax, which I guess is why I keep adding brackets, and often refer back to the help docs to and end up fixing the โin-columnโ syntax.
How could the help doc be changed to help you?
Lol. Not sure I would change it just for me as others may not think like me
Butโฆ I am definitely not a good help text writer and I am sure examples from other applications can be leveraged. maybe itโs just adding better clarity what is meant by each option, and the acceptable data types.
example:
current help
LOOKUP( find-value , in-dataset , in-column , return-column )
alternative
LOOKUP( value-to-find , dataset-source-name , in-which-column , column-to-return )
variable options:
value-to-find | [col name] or โtextโ
dataset source name | โtextโ
in-which-column | โtextโ
column-to-return | [col name]
Maybe โcolumn-to returnโ could be 'value -to-return" You have column names and column values.
Wellโฆ since itโs expected to be a column name, I guess itโs really โcol-to-return-value-fromโ โฆ but thatโs way long!
@Jeremy_Fโs solution is functionally equivalent, as a deref is essentially a LOOKUP(), but requires a specific table structure that might not exist or may be undesirable.
Thank you and all others for your help. I try it and the expression assistand marked it as ok. But if i try it in the app nothing is copy to the target column.
Must both tables have the column AuftragsNr ? Because the sourcetable havenยดt.
The columns named by the third and fourth arguments must exist in the table named by the second argument.
Do want to copy between two tables, or between two rows within a single table?
I want to copy between two tables.
And yes it work. Sorry iiยดs my mistake. You write itยดs only work if I creat a new row. First I try it with an existed row.
Is there an nother way I can do if the row is exist? Sometimes I have to fill out the longtext field later in the existing row. Perhaps by an action button?
User | Count |
---|---|
17 | |
12 | |
5 | |
5 | |
5 |