How can I write a nested IF statement in Zapier? - zapier

I'm trying to use Numbers: Spreadsheet style formula to write a nested IF statement and I keep getting this error: Error parsing response. We got: " Show details. Here is the statement: 
If("{{Alpine School District Schools}}"<>"", "{{Alpine School District Schools}}", If ("{{Bonsall Unified School District Schools}}"<>"","{{Bonsall Unified School District Schools}}", "NA")
(As an FYI, when I copy and pasted this here I removed the numbers that preceded the fields when copying and pasting {{110470936__Alpine School District Schools}}) 
This is stating if the field (which is a picklist) Alpine School District is not blank, add the school selected in this field; if it is blank but Bonsall School district is not blank, add the school selected in the Bonsall School District field, if Bonsall is also blank, add “NA”.
Any guidance on how to write to correctly is welcome.

I believe you don't have enough closing parens on the end of your statement. Here's your input, but spaced out to be more informative:
If(
"{{Alpine School District Schools}}"<>"",
"{{Alpine School District Schools}}",
If (
"{{Bonsall Unified School District Schools}}"<>"",
"{{Bonsall Unified School District Schools}}",
"NA"
)
<-- missing paren
Fixing it may be as easy as adding ) to the end of your statement.

Related

Searching for specific characters in user input

Within my house table I have a postcode for each house.
I also have an index view for my housing table that contains a table which contains headings such as 'Name', 'Address', 'State'. I was looking to integrate a text_field_tag that would allow user's to input the 9 digits of a postcode in order to filter the table to only show the house with that postcode. However, I also want the user to be able to input the first 4 digits of their postcode e.g. '7644' and it would display all houses that begin with '7644' e.g. two records one with the postcode of the '76444-5645' and '76443-123'. Ideally I would apply logic through my '#search' variable within my houses controller. However I am up to any ideas or tips.
In order to instantiate the house model I would use #house = House.all
I'll be honest I don't know where to begin with this. I have arel_sql in my system so I assume that would be used to query for the search.
It depends on how your models/controllers are defined but you're probably looking for the SQL operator LIKE + '%', which allows you to search for a pattern in a given column. Example:
LIKE Operator
Description
WHERE CustomerName LIKE 'a%'
Finds any values that start with "a"
Assuming you're using ActiveRecord and your model is House, it wouldn't event need to instantiate all houses. Your code would look something like this:
postcode = '7644'
#houses = House.where('postcode LIKE ?', "#{postcode}%") # this returns where the postcode starts with '7644'
another similar SO answer for reference

Quickbooks - migrate import IIF to QODBC

I'm trying to migrate my actual logic to import invoices into Quickbooks using QODBC tool, and I'm having trouble finding the relationship of the columns of the IIF file with the columns of the DB.
Here is the header of my IIF file
!TRNS TRNSID TRNSTYPE DATE ACCNT NAME CLASS AMOUNT DOCNUM MEMO CLEAR TOPRINT NAMEISTAXABLE ADDR1 ADDR2 ADDR3 ADDR4 ADDR5 PONUM DUEDATE TERMS OTHER1
!SPL SPLID TRNSTYPE DATE ACCNT NAME CLASS AMOUNT DOCNUM MEMO CLEAR QNTY PRICE INVITEM PAYMETH TAXABLE VALADJ SERVICEDATE OTHER2 EXTRA
!ENDTRNS
In which tables and columns should insert data to generate an invoice with similar data that I have now?
There is some documentation where this all these relationships?
Thanks in advance!
I would suggest trying Bait and Sync technique.
Enter something unique in customer, note, address, item, etc in the front end or the source from where you are creating the IIF file. Once the data is entered you can export it to IIF file.
Once you have that you know which fields of IIF file links to what.
You can then refer QODBC Invoice / InvoiceLine table schema/relationship.
Refer:
http://qodbc.com/schema.htm
You need to then do the field mapping, get the SQL Statement generated and execute the insert statements.
Refererences:
http://support.flexquarters.com/esupport/index.php?/Knowledgebase/Article/View/2389/0/how-to-create-invoices-using-qodbc
http://support.flexquarters.com/esupport/index.php?/Knowledgebase/Article/View/2810/44/how-to-insert-invoice-using-excel---vba

Getting some informations of Patient from HL7 Message V2.4

I need to get some information about patient from HL7Message V2.4(Or V2.3, V2.3.1), How do i get these?
i need these; Filenumber, recorddate, department name, doctor, father name, complaint, diagnosis info and diagnosis date, etc.
You might be refering to certain terms in your own language. As far as I can break down your terms below is a list for your requirements.
File number :
PID.18 Patient account number, thats where the filenumber goes. If filenumber is treated as patient IDs then its either PID.2 or PID.3
Father name :
in NK1.2 or GT1.3 or IN1.16 segment, if relation ship is established. That is, if NK1.3,GT1.11 or IN1.17 code suggest it is a father son relationship.
Department :
PV1.3.1 -point of care in an ADT message or in the LDP segment in LDP.2 in an MFN message.
Doctor:
PV1.7 Attending provider.
PV1.8 referring provider.
PV1.52 Auxilliary Provider.
OBR.16 Ordering provider.
Diagnosis Information:
DG1 segment
DG1.3 - Code
DG1.5 - Date and time
You can find more documentation on this link
Just check the relevant fields of the PID segment, especially
PID/5 Patient Name
PID/7 Date/Time of Birth
PID/8 Sex
PID/11 Patient Adress
PID/..
a.s.o
You will find location data in the PV1 segment.
All the doctors should be in PV1 too.
Diagnosis data is in the DG1 segment.
Fathers name could be in NK1.

Find most recent donation excluding funds beginning with X

I'm trying to grab the gift date of the most recent donation (in $USD) to my organization that has a fund ID not beginning in X (those are Canadian donations). Here's the code (in the controller) that I've used to pull out the gift date of the most recent overall donation, but it's a Canadian gift (fund_id = XP05). How do I get the most recent donation with a fund ID not beginning with an X?
#income_batch = Gift.between(Date.today - 2.weeks, Date.today, :field => :gift_date).order('gift_date DESC').first.gift_date
Assuming fund_id is a string field within your gifts table, you can use not like:
Gift.where("fund_id not like 'X%").between....
You should also avoid using an _id postfix on fields unless they're foreign keys, as Rails convention dictates that _id is specific for this purpose.
If fund_id is a foreign key, and you have a belongs_to :fund inside your Gift model, you can use joins and not like:
Gift.joins(:fund).where("funds.name not like 'X%").between....
This assumes that the field within the funds table is called name.

Is there a benefit to creating a very generic data model for a Rails 3 Project?

A Product can have lots of things said about it, I'll call them Properties. It can have a brief description. But that description can be in multiple languages. Likewise, it can have multiple Prices, some which are specific to Customers. Given the following data:
Product:
identifier: 123-ABC
Price:
value: $1.25
currency: USD
customer: Wal-Mart
Price:
value: $1.96
currency: USD
Description:
short: "A Widget"
language: EN
Description:
marketing: "Made from Space Age Polymers."
language: EN
Does it make sense to use STI here, and make a generic set of models:
Product has_many Properties
Property has_many Attributes
Price < Property
Description < Property
Package < Property
Is this way too broad of a generalization in the data model? Should I just stick with regular models and their associated tables?
No.
Seriously
No.
at least not in a SQL database.
If you want to use Cassandra or a NoSQL database, that's exactly how everything is stored.
Read my answer here
and
Read this
Think of a SQL Table with First Name, Last Name, and Birth date
Find all the LNAME = Page older than 30.
in one table it's
SELECT FNAME, LNAME, (SYSDATE - BDATE)/365 age
FROM people
WHERE LNAME = 'Page' and BDate < SYSDATE - 30*365
Now try it in an EAV
Post your answer.

Resources