Hello all, I would like to patch the below data , every time i change it , it is creating a new row. So i wrote the below code . If there is no data with Concatenate_date_1.Text i would like to create defaults row, or else, I would like to patch to the existing data. Could you help me where i am going wrong .? Thanks
If(
IsEmpty(
Filter(
Todolist_QC,
Dateid_Todo = Concatenate_date_1.Text
)
),
Patch(Todolist_QC,
Defaults(Todolist_QC),
{
Date:DatePicker_todo.SelectedDate,
Shift:'Schicht value_to_do'.Selected.Value,
'Gaskontrolle & ggf. Zylinder wechseln ':TextInput7.Text,
'Lösungsmittel entsorgen':TextInput7_1.Text,
'Lieferung annehmen & auspacken':TextInput7_2.Text,
BOS:TextInput7_3.Text,
GMP:TextInput7_4.Text,
Dateid_Todo:Concatenate(Text(DatePicker_todo.SelectedDate,"[$-en-US]yyyy"), "_", Text(DatePicker_todo.SelectedDate,"[$-en-US]mm"), "_", Text(DatePicker_todo.SelectedDate,"[$-en-US]dd"))
}
)
)
Solved! Go to Solution.
If what you are stating is that if there is an existing record, you want to update it and if there is none, then you want to create one, then consider the following formula:
Patch(Todolist_QC,
Coalesce(LookUp(Todolist_QC, Dateid_Todo = Concatenate_date_1.Text), Defaults(Todolist_QC)),
{
Date:DatePicker_todo.SelectedDate,
Shift:'Schicht value_to_do'.Selected.Value,
'Gaskontrolle & ggf. Zylinder wechseln ':TextInput7.Text,
'Lösungsmittel entsorgen':TextInput7_1.Text,
'Lieferung annehmen & auspacken':TextInput7_2.Text,
BOS:TextInput7_3.Text,
GMP:TextInput7_4.Text,
Dateid_Todo:Concatenate(Text(DatePicker_todo.SelectedDate,"[$-en-US]yyyy"), "_", Text(DatePicker_todo.SelectedDate,"[$-en-US]mm"), "_", Text(DatePicker_todo.SelectedDate,"[$-en-US]dd"))
}
)
The Coalesce statement in this formula will lookup a record based on the criteria of the Dateid_Todo. If it exists, then it is used as the basis of your Patch (i.e. you will be updating a record), if not, then the Defaults will be used (you will be creating a new record).
I hope this is helpful for you.
If what you are stating is that if there is an existing record, you want to update it and if there is none, then you want to create one, then consider the following formula:
Patch(Todolist_QC,
Coalesce(LookUp(Todolist_QC, Dateid_Todo = Concatenate_date_1.Text), Defaults(Todolist_QC)),
{
Date:DatePicker_todo.SelectedDate,
Shift:'Schicht value_to_do'.Selected.Value,
'Gaskontrolle & ggf. Zylinder wechseln ':TextInput7.Text,
'Lösungsmittel entsorgen':TextInput7_1.Text,
'Lieferung annehmen & auspacken':TextInput7_2.Text,
BOS:TextInput7_3.Text,
GMP:TextInput7_4.Text,
Dateid_Todo:Concatenate(Text(DatePicker_todo.SelectedDate,"[$-en-US]yyyy"), "_", Text(DatePicker_todo.SelectedDate,"[$-en-US]mm"), "_", Text(DatePicker_todo.SelectedDate,"[$-en-US]dd"))
}
)
The Coalesce statement in this formula will lookup a record based on the criteria of the Dateid_Todo. If it exists, then it is used as the basis of your Patch (i.e. you will be updating a record), if not, then the Defaults will be used (you will be creating a new record).
I hope this is helpful for you.
Perfect it works, 🙂
User | Count |
---|---|
255 | |
114 | |
95 | |
48 | |
38 |