Google Sheets two way calculation/updating/iterative calculation - excel

So I have a google sheet dataset. Great! Using filter() to run a few reports off of it. No problem.
The issue is, the end-users want to be able to put comments into the reports that have been run off, and have the main dataset update based on these comments. Additionally, as things change, the data in the reports move around. They'd like the comments they make to move around with them.
So what I initially did was created a "Comment database", which checked every report and the main dataset for comments, and pulled them in. Works like a charm.
I also included a OR(Not(Now()="Dummy") clause to the comment database aggregation to force recalculation every time a change was made.
I then enabled iterative calculations (Tried at 1, 2, and 3 iterations), and had everything be an index-match back to the comments, with the idea being that if someone entered a new comment, it would update the dataset, which would then update the main report once they dragged the formula back over.
In Excel, this would work perfectly - the iterative calculation would "store" the comment value, and it would continue to cycle through.
However, in Google sheets, this isn't working.
I've asked if the obvious solution of "Just update the main dataset whenever you want to change something" would work. For reasons unknown, the answer is no.
How can I get what I want? I'm open to using google scripts if necessary, although I'm not too familiar with the language.
As an example:
Dataset:
ID: 123
Comment: None
Report:
ID: 123
Comment: "Hello World"
Becomes:
Dataset:
ID:123
Comment:"Hello World"
Report:
ID:123
Comment:"Hello World"
The comment has moved from the report to the dataset
Then once we add ID 456:
Dataset:
ID: 123
Comment: "Hello World"
ID: 456
Comment: None
Report:
ID: 456
Comment: None
ID: 123
Comment: "Hello World"
The comment has moved down with the ID it's associated with

So it turns out I had a bad conditional statement, and fixing it fixed the problem.
This type of system will work as a two-way street for information, it's just silly convoluted.

Related

Table values moved after being added to old QGIS version: behaves normally on current version

I am teaching a man the basics of QGis for a project he needs to do at his work. He has very little computer knowledge and would like to standardise the work as much as possible (specific workarounds would complicate it too much for him). His QGis version is 3.16 "Hannover" and as this is a work laptop he does not have permission to download a newer version.
We have been having problem with one specific table. The first few rows are below, written exactly as they are originally.
Baum-Nr. Baumart BHD Alter Y X Biotopbaum Klassifizierung Bemerkungen
1 Buche 86 120 49.1356 11.0488 A Altbaum Freistellen !!!
2 Kiefer 45 100 49.13561 11.04883 Hlb,Bs,Th Höhlenbaum
3 Kiefer 32 100 49.13571 11.04579 Hlb,Sw,Th Höhlenbaum
4 Kiefer 74 120 49.13513 11.0495 A Altbaum
After adding it from Excel to QGis through "add vector layer", the header "Klassifizierung" becomes one of the coordinates and I believe one of the columns are switched (unfortunately, I can't remember specifics. This is a small side job and I haven't had time to look into it for days. I should have taken a photo, but this isn't possible anymore). We have attempted to copy the column into a new Excel document and transferring it to QGis again, and this time the headers were shoved one cell to the right such that "Y" was placed over "X" and "Biotopbaum" over "Klassifizierung", for example.
I could not find a way to fix the import problem in his laptop. He e-mailed me the problematic table and I opened it successfully in my QGis 3.26 "Buenos Aires".
I believe this may be a problem with his QGis version, but it is curious that we only encountered it with this one table. All other tables we have worked with have the same headers and the same kind of data on their respective rows.
Is this a known problem, or have other people faced similar situations? Could someone explain what could be causing it? Would there be a way to fix it such that we can successfully import the table without having to edit it in QGis? This is not a solution the man would accept.
Thank you in advance.
Remove the commas in the Biotopbaum field or replace them with a less common delimiter. In fact, remove all punctionation (e.g., Baum-Nr. >> remove the period ".").
Also save the table into a csv format and try to import.

Embedded IF AND Statements in Excel

I searched around on this site and found something similar to what I need, but I haven't been able to get it to work for me yet. I was able to get it to work when I do only half of it, but when I try to work in the other 2 conditions with AND statements, it gets messed up and I can't figure out what's going wrong.
The partial string of code that worked for me is this
=IF(M7>O7, IF(P7="R", 3, IF(P7="O", 2, IF)))
I have statements that would give different output...
If m7>o7 and p7="R" output a value of 3
If m7>o7 and p7="O" output a value of 2
If o7>m7 and p7="O" output a value of 1
If o7>m7 and p7="R" output a value of 0
Thanks in advance!
=IF(M7>O7,IF(P7="R",3,2),IF(P7="R",0,1))
Per the comment:
=IF(AND(M7<>"",O7<>"",P7<>""),IF(M7>O7,IF(P7="R",3,2),IF(P7="R",0,1)),"")

Pysnow - How to do an update record by based on something other than by only text-value?

I have the following problem.
I've written a program on Python to be run on a web-page which enters records into ServiceNow. I work in a help desk and for example automating password resets would be a huge help. I can create these records through Pysnow-module for Python and everything else works fine, but I can only enter values (like Configuration Item) only based on their text-name. This is a problem because many values have different companies, billing etc. and they have the same name, so my queries end up for random companies. User could be from company A, timecard for company X, item for company E and so on.
When i fetch a record with a certain field:
Command: r.get_one(fields=['u_configuration_item'])
I get this as response:
{'link': 'https://xxxxx.service
now.com/api/now/table/core_company/f7a9a64430b070c8e017981c4ba7a0e7',
'value': 'f7a9a64430b070c8e017981c4ba7a0e7'}
When i try for example make a dictionary out of the response:
dict = {'value': 'xxx', 'link': 'xxx'}
'u_configuration_item': dict
It doesn't give me an error, but just makes a record with blank field.
The following kind of code works fine, but it's just this 'Random Value' comes with a company/billing which is not right for the customer.
s = pysnow.Client(instance='xxxx', user='xxxx',password='xxxx')
result = r.update({'u_configuration_item': 'Random Value'})
print(result['number'])
I've tried googling, entering different kinds of info, but just can't get forward.
I found an answer, i though i had tried this before, but just by replacing "Random value" with sys_id which is unique to every single record it works. I'm happy i was persistent though and keep trying, almost was about to give up.

2 Sequential Transactions, setting Detail Number (Revit API / Python)

Currently, I made a tool to rename view numbers (“Detail Number”) on a sheet based on their location on the sheet. Where this is breaking is the transactions. Im trying to do two transactions sequentially in Revit Python Shell. I also did this originally in dynamo, and that had a similar fail , so I know its something to do with transactions.
Transaction #1: Add a suffix (“-x”) to each detail number to ensure the new numbers won’t conflict (1 will be 1-x, 4 will be 4-x, etc)
Transaction #2: Change detail numbers with calculated new number based on viewport location (1-x will be 3, 4-x will be 2, etc)
Better visual explanation here: https://www.docdroid.net/EP1K9Di/161115-viewport-diagram-.pdf.html
Py File here: http://pastebin.com/7PyWA0gV
Attached is the python file, but essentially what im trying to do is:
# <---- Make unique numbers
t = Transaction(doc, 'Rename Detail Numbers')
t.Start()
for i, viewport in enumerate(viewports):
setParam(viewport, "Detail Number",getParam(viewport,"Detail Number")+"x")
t.Commit()
# <---- Do the thang
t2 = Transaction(doc, 'Rename Detail Numbers')
t2.Start()
for i, viewport in enumerate(viewports):
setParam(viewport, "Detail Number",detailViewNumberData[i])
t2.Commit()
Attached is py file
As I explained in my answer to your comment in the Revit API discussion forum, the behaviour you describe may well be caused by a need to regenerate between the transactions. The first modification does something, and the model needs to be regenerated before the modifications take full effect and are reflected in the parameter values that you query in the second transaction. You are accessing stale data. The Building Coder provides all the nitty gritty details and numerous examples on the need to regenerate.
Summary of this entire thread including both problems addressed:
http://thebuildingcoder.typepad.com/blog/2016/12/need-for-regen-and-parameter-display-name-confusion.html
So this issue actually had nothing to do with transactions or doc regeneration. I discovered (with some help :) ), that the problem lied in how I was setting/getting the parameter. "Detail Number", like a lot of parameters, has duplicate versions that share the same descriptive param Name in a viewport element.
Apparently the reason for this might be legacy issues, though im not sure. Thus, when I was trying to get/set detail number, it was somehow grabbing the incorrect read-only parameter occasionally, one that is called "VIEWER_DETAIL_NUMBER" as its builtIn Enumeration. The correct one is called "VIEWPORT_DETAIL_NUMBER". This was happening because I was trying to get the param just by passing the descriptive param name "Detail Number".Revising how i get/set parameters via builtIn enum resolved this issue. See images below.
Please see pdf for visual explanation: https://www.docdroid.net/WbAHBGj/161206-detail-number.pdf.html

Netsuite - Transfer Inventory error

I have been using NetSuite for only a short time, and already hate it. I am sorry if this is a stupid question, but I haven't been able to find an answer so far, either in the Netsuite docs, StackOverflow or other websites. In fact, the answers I found have resulted in an error.
My company requires a script to transfer inventory based on an EDI input file. Reading the file is no problem, even parsing it is working. However, actually inserting the data is proving problematic.
I have been able to insert normal records, but Inventory Transfer records are giving me problems.
From Stack Overflow I found and adapted some code into the following:
var xfer = nlapiCreateRecord("inventorytransfer");
xfer.setFieldValue("trandate", FormatDate("20160101"));
xfer.setFieldValue("location", 9);
xfer.setFieldValue("transferlocation", 9);
nlapiSelectNewLineItem('invt');
nlapiSetLineItemValue("invt","invtid",1, 189);
nlapiSetLineItemValue("invt","adjustqtyby", 1, "5");
nlapiCommitLineItem('invt');
var id = nlapiSubmitRecord(xfer);
The FormatDate function just exchanges the date from the text file into a system date NetSuite can understand.
However, when I run this code I get the following error:
USER_ERROR: You must enter at least one line item for this transaction.
I thought inserting the line item was the reason to use nlapiSelectNewLineItem, but I guess not. Also nlapiCreateNewLineItem doesn't seem to exist.
The values I am inserting are all just test data, as I'm testing this in the debugger. Location 9 exists, as does item 189.
My full script finds these id's based on string values from the text files. But since this is the section that doesn't work I have set it apart to test.
Can anyone help with this?
You did not specify the type of script you are using, but, looks like you are not setting the fields on the record object, but, setting the value on current record. Below, is the suggested code.
Also, there is no sublist named invt, it should be inventory. Also, there is no field as such invtid, I think most probably you want to setup item, the field Id should be item. You might want to refer SuiteScript Record Browser as well for a help on correct Ids
var xfer = nlapiCreateRecord("inventorytransfer");
xfer.setFieldValue("trandate", FormatDate("20160101"));
xfer.setFieldValue("location", 9);
xfer.setFieldValue("transferlocation", 9);
xfer.selectNewLineItem('inventory');
xfer.setCurrentLineItemValue("inventory", "item", 189);
xfer.setCurrentLineItemValue("inventory","adjustqtyby", "5");
xfer.commitLineItem('inventory');
var id = nlapiSubmitRecord(xfer);
If you are using Bin/Lot Numbered Items, please see help topic "Sample Scripts for Advanced Bin / Numbered Inventory Management"

Resources