How can i append a text-field values .Is there any function like update ,and i want to do it from server side scripting ,can anyone give me suggestions
for update the value in any form using its name and field name
frappe.db.set_value("DocType", docname, "fieldname", value_to_set)
But when i want to set the value from a sql query ,which is returning multiple rows how can i do it …
Can you explain in detail? So I can help you better. What are you trying to do?
Well i am trying to get the serial no names from the items table and trying to append them in the text field in another document .
Here is my code
So, Checker is your doctype in that you are updating serial no series.
As I see you are accessing series no incorrectly. It should be like,
item_series_no = frappe.db.sql("""select serial_no_series
from tabItem where serial_no_series is not null""", as_dict=True)
for series in item_series_no:
print series.get('serial_no_series') #this gives you series_no
Thanks for that reply but i want to insert that rows values means the serial no into the text field but the update is updating for every iteration and erasing the previous ones ,how can i get all of them in the text field.
because you are updating field value in for loop. Make it as one and then update.
item_series_no = frappe.db.sql("""select group_concat(serial_no_series) as series_no
from tabItem where serial_no_series is not null""", as_dict=True)
if item_series_no[0].get('series_no'):
a.update('text': item_series_no[0].get('series_no'))
check my given query for item_series_no