Formula Won't Stop Skipping Lines When Writing Data - regex

I'm currently working on a project using Google form to gather data into an excel sheet, and then organize the data based on answers of the form. After an employee selects a department and submits a form, I would like to filter each response by department to its own page within the workbook.
I've listed my current formula below. As of now, it will only import the data on the same row when it is sorted into a new page, thus leaving many blank spaces in between information. Is there a way to make sure it will not skip rows during the import?
=IF(REGEXMATCH('Form Responses 1'!D2:D1101, "Department Name"), 'Form Responses 1'!B2:B1101," ")

try:
=FILTER('Form Responses 1'!B2:B1101,
REGEXMATCH('Form Responses 1'!D2:D1101, "Department Name"))

Related

How can I tidy up data responses from Google Forms?

Can anyone please help me tidy up Google Spreadsheet data responses after a Google Form with a checkbox has been filled?
When someone attends training, a Google Form is filled which automatically populates a Google Spreadsheet with:
the training event
the date of the event and
all of the employees who attended that event.
There could be a number of employees attending one event so in the form, there is a checkbox giving the option to tick multiple employees. Below is an example of the Google 'Response Form' spreadsheet after the Form has been submitted:
The issue is that the Response Form is difficult to look at so I want to tidy it up and make it easy to use the Query function. Ideally, I would like it to look like this:
Can anyone help me?
you can use this formula:
=ARRAYFORMULA(QUERY(SPLIT(TRANSPOSE(SPLIT(TRIM(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
IF(IFERROR(SPLIT(D:D, ";"))<>"", "♦"&B:B&"♥"&C:C&"♥"&
REGEXREPLACE(SPLIT(D:D, ";"), "^, ", ), )),,999^99)),,999^99)), "♦")), "♥"),
"order by Col2", 1))

django setting filter field with a variable

I show a model of sales that can be aggregated by different fields through a form. Products, clients, categories, etc.
view_by_choice = filter_opts.cleaned_data["view_by_choice"]
sales = sales.values(view_by_choice).annotate(........).order_by(......)
In the same form I have a string input where the user can filter the results. By "product code" for example.
input_code = filter_opts.cleaned_data["filter_code"]
sales = sales.filter(prod_code__icontains=input_code)
What I want to do is filter the queryset "sales" by the input_code, defining the field dynamically from the view_by_choice variable.
Something like:
sales = sales.filter(VARIABLE__icontains=input_code)
Is it possible to do this? Thanks in advance.
You can make use of dictionary unpacking [PEP-448] here:
sales = sales.filter(
**{'{}__icontains'.format(view_by_choice): input_code}
)
Given that view_by_choice for example contains 'foo', we thus first make a dictionary { 'foo__icontains': input_code }, and then we unpack that as named parameter with the two consecutive asterisks (**).
That being said, I strongly advice you to do some validation on the view_by_choice: ensure that the number of valid options is limited. Otherwise a user might inject malicious field names, lookups, etc. to exploit data from your database that should remain hidden.
For example if you model has a ForeignKey named owner to the User model, he/she could use owner__email, and thus start trying to find out what emails are in the database by generating a large number of queries and each time looking what values that query returned.

I would like to use data from a table to create a selectmultiple list on my form

I am pretty new to python/django, but previously programmed in C# and VB.Net. I need to create a list on my django form that contains data elements from a PGSQL table. The user should be able to select multiple rows and then I would formulate a query that I would send back to the server. I have researched, but have not found anything to point me in the right direction. I will show my code below.
forms.py
PROD_MULTI_RECORDS=[
('darryl.dillman','darryl.dillman'),
('richard.mcgarry','richard.mcgarry'),
('janet.delage','janet.delage')
]
class rdsprodform(forms.Form):
selectmulti =
forms.CharField(widget=forms.SelectMultiple(choices=PROD_MULTI_RECORDS),
required = False, label = "Please select records to process")

How to convert action from Quotation to Sales order when sale confirm For odoo 10

I am entering data in Quotation screen and i want that when i confirm sale for this Quotation than screen should be move to Sales Order menu. Firstly i got the action id for both action(Quotation and Sales order). But i facing problem that how to pass this action id in action_confirm method? Is there any solution for this type problem?
This is my code:
#api.multi
def action_confirm(self):
if self.partner_id.pet_names:
for record in self.partner_id.pet_names:
if record == self.pet_names_info:
if self.order_line:
for s in self.order_line:
if s.product_id:
if self.ser1 or self.ind_ser1:
self.confirm_rental_service() # Rental service
self.confirm_rental_service_history() # Rental history maintain
break
res = super(sale_order_pet, self).action_confirm()
if res:
self.confirm_email_template()
action = self.env.ref('sale.action_orders').read()[0]
action['res_id'] = self.ids[0]
action['name'] = 'Sales Order'
return action
else:
raise ValidationError("Please Add Products in Order Lines")
Thanks in advance
sale.action_orders action invocation looks fine to me.
Have you tried to debug your code or just try to see whether it passes through all the if/else statements required to reach the action = self.env.ref('sale.action_orders').read()[0] statement?
What does Odoo return when you try to confirm the quotation / order?
According to your code, I guess that res.partner's pet_names might be a one2many field: is sale.order's pet_names_info a record belonging to the same class of pet_names? pet_names_info suggests something like a text field, not a one2many field.
Furthermore, comparing two records in conditional statement sounds a bit weird IMHO.
PS: by the way - naive question - is the first "if" statement closed by an "else" code chunk?

How to remove the meta data field from multi id queries

I am using the open_graph Explorer tool to test this out and I need to be able to get the first_name, last_name and installed from 1000 users. At the moment I group up the users in grouped of 50 for a single query and batch them into up to 20 queries in a batch request.
A single query looks as follows
?ids=100003825998801,100003825998802,547884299,100003825998803,100003825998804,100003825998805,100003825998806&fields=first_name,last_name,installed
Now, the question is, when you use multiple ids in a single query like I did, facebook seems to "force" certain fields on you, large fields, such as "metadata" and "fields". Is it possible to remove these fields from the result set of the query?
Also, any advice on how to make this more efficient would also be great.
Thank.
Have you considered using FQL instead …?
SELECT first_name, last_name, is_app_user FROM user
WHERE uid IN (100003825998801,100003825998802,547884299,100003825998803,
100003825998804,100003825998805,100003825998806)
– that gives you just the info you want, you only have to watch out for the fact that the installed field is named is_app_user in FQL.