What?
This is a quick article on what should be a simple mathematics equation: Determine the quarter from a given month.

Why?
Fine if you are determining the quarter by the month and your Fiscal year starts from January, simply divide by 3...

How?
I'm showing this in Zoho Deluge but the logic can be adapted to other code. You will need this snippet of code for the examples below:
copyraw
l_Months = {1,2,3,4,5,6,7,8,9,10,11,12};
l_MonthNames = {"January","February","March","April","May","June","July","August","September","October","November","December"};
  1.  l_Months = {1,2,3,4,5,6,7,8,9,10,11,12}
  2.  l_MonthNames = {"January","February","March","April","May","June","July","August","September","October","November","December"}
Category: Zoho :: Article: 703

What?
This is a quick article to demonstrate how to compare two datetime values with the timezone specified.

Why?
A client's ZohoCRM had a different timezone setting than the user a script would be run as. The time difference was just one hour but this caused problems if comparing two datetime values. In this particular case, we needed to check on the expiry of an access token used in OAuth2.0 for an API.

How?
All with deluge but we will split the date and time value obtained from a CRM field and compare it to the current time combined with a timezone. In this particular case, we will switch the current time to Europe/London (You can use an abbreviation such as GMT but this doesn't seem to check if daylight savings is in effect):

Xero API: Standard PHP/cURL Create Invoice

What?
This is an article documenting a generic script that can be used to push an invoice to the demo Xero environment. Following the steps below will connect you to the Demonstration environment of Xero at no cost to you the developer.

How?
Similar to my ZohoAPI script the process is:
  1. Start with a HTML form to add your client ID/client Secret/scopes and Redirect URI. These get stored in a temporary file to retrieve later.
  2. Then you get a button that will return the "CODE" variable via GET (URL). Clicking on this will get the CODE variable and use it to generate a refresh token.
  3. Then with the refresh token generate an access token.
  4. Then with the access token get a connection "TenantID".
  5. Then with the tenantID we can retrieve records and/or finally create an invoice (accounts receivables).

Applies To:
  • MS Windows 10 Pro v10.0.18362 Build 18362 (64-bit)
  • Google Chrome Browser v79.0.3945.88 (Official Build) (64-bit)
  • AutoHotkey v1.1.30.01
What?
This is an article to create a standalone application which lists all the Google Chrome Profiles on your Windows 10 workstation in alphabetical order.

Why?
This program will be redundant if Google ever update their Chrome browser to list the multiple profiles in alphabetical order like it used to be... but to date they have not. So I made a program that lists the profiles in alphabetical order and can be double-clicked to open the Chrome browser with that profile.

How?
So you will need to be able to run AutoHotkey or create executables from an AHK file.

What?
This is a quick note on how to reduce a whole bunch of CSS into a single line without unnecessary spaces and new lines.

Why?
What I have:

copyraw
#copyright a{
    margin: 10px 0 0 85px;
    box-shadow: 5px 5px 5px 0px rgba(51, 51, 51, 0.3);
}
  1.  #copyright a{ 
  2.      margin: 10px 0 0 85px
  3.      box-shadow: 5px 5px 5px 0px rgba(51, 51, 51, 0.3)
  4.  } 

What I want:

copyraw
#copyright a{margin:10px 0 0 85px;box-shadow:5px 5px 5px 0px rgba(51,51,51,0.3);}
  1.  #copyright a{margin:10px 0 0 85px;box-shadow:5px 5px 5px 0px rgba(51,51,51,0.3);} 


How?
So I'm doing this with a regular expression to get rid of newlines:

copyraw
$v_AppStyle = "
#copyright a{
    margin: 10px 0 0 85px;
    box-shadow: 5px 5px 5px 0px rgba(51, 51, 51, 0.3);
}";
$v_AppStyleFormatted = preg_replace('/\s+/', ' ', $v_AppStyle);
  1.  $v_AppStyle = " 
  2.  #copyright a{ 
  3.      margin: 10px 0 0 85px
  4.      box-shadow: 5px 5px 5px 0px rgba(51, 51, 51, 0.3)
  5.  }"
  6.  $v_AppStyleFormatted = preg_replace('/\s+/', ' ', $v_AppStyle)

and a few str_replace arrays:

copyraw
// exceptions
$a_ReplaceFrom1 = array("px ", "0 ", " a");
$a_ReplaceTo1 = array("px?", "0?", "?a");
$v_AppStyleFormatted = str_replace($a_ReplaceFrom1, $a_ReplaceTo1, $v_AppStyleFormatted);

// replace all spaces to empty and replace question marks back to spaces
$a_ReplaceFrom2 = array(" ", "?");
$a_ReplaceTo2 = array("", " ");
$v_AppStyleFormatted = str_replace($a_ReplaceFrom2, $a_ReplaceTo2, $v_AppStyleFormatted);
echo $v_AppStyleFormatted;
  1.  // exceptions 
  2.  $a_ReplaceFrom1 = array("px ", "0 ", " a")
  3.  $a_ReplaceTo1 = array("px?", "0?", "?a")
  4.  $v_AppStyleFormatted = str_replace($a_ReplaceFrom1, $a_ReplaceTo1, $v_AppStyleFormatted)
  5.   
  6.  // replace all spaces to empty and replace question marks back to spaces 
  7.  $a_ReplaceFrom2 = array(" ", "?")
  8.  $a_ReplaceTo2 = array("", " ")
  9.  $v_AppStyleFormatted = str_replace($a_ReplaceFrom2, $a_ReplaceTo2, $v_AppStyleFormatted)
  10.  echo $v_AppStyleFormatted
Category: Personal Home Page :: Article: 697

What?
Thought I'd put an article here to remind me how to make the retrieval of a record case-insensitive.

Why?
Consider that I have the following creator table:
copyraw
Product_Name   Product_SKU   
-------------- -------------
MyProduct1     TEST01
Myproduct2     TEST02
myproduct3     TEST03
  1.  Product_Name   Product_SKU 
  2.  -------------- ------------- 
  3.  MyProduct1     TEST01 
  4.  Myproduct2     TEST02 
  5.  myproduct3     TEST03 

I'm trying to insert a record for a new product if it doesn't exist in the table but if it does exist then to simply skip adding the product.
Category: Zoho :: Article: 696

What?
An article on setting a date field to either the first Monday of the next month or to the last Tuesday of the current/next month. What I mean by the last Tuesday is if the last Tuesday of the month is before the current date, then set it to the last Tuesday of next month.

Why?
This was a request by a client who instead of specifying the 1st of every month, or 15th of each month, to say the first Monday of the month (ignoring bank holidays) or to say the last Tuesday of the month.

How?
Quite easily. For the first Monday of the month, it is likely that even if today was the first day of the month and coincidentally a Monday, then we would want to specify the field date to be the first Monday of the next month. If however we want the last Tuesday of the month and that Tuesday happens before today, then we want the last Tuesday of the next month.

What?
So this is a quick article to demo how to center an iframe horizontally and vertically in a screen/viewport in pure CSS (no JavaScript allowed). This CSS centers it by its center point rather than the top/bottom/left/right outline.

Why?
On a mobile, a client's site uses an external page embedded by iframe. When the app within the iframe has an alert message, it popups a div at the centre of its app. The alert message is always at the center of the iframe but if the iframe has a height of 2000 pixels, the iframe gets aligned to the top of the parent...

How?
We're going to use a touch of CSS and instead of determining heights and alignment with JS.

What?
A quick article on how to count within a map. I didn't have too much difficulty getting this to work and I'm not sure if there are better ways of counting so I'm documenting it to see if I can refine the code or find a some short codes that will do the same.

Why?
I'm aiming to automate a process which counts the number of products allocated to an account or in total for a purchase order. Let us assume we have the following in a form/report called "Stock_Upload":
copyraw
RowID	Name	            SKU	        Account Email	
0001	Test Product 1	    TEST001	    This email address is being protected from spambots. You need JavaScript enabled to view it.	
0002	Test Product 1	    TEST001	    This email address is being protected from spambots. You need JavaScript enabled to view it.	
0003	Test Product 1	    TEST001	    This email address is being protected from spambots. You need JavaScript enabled to view it.	
0004	Test Product 1	    TEST001	    This email address is being protected from spambots. You need JavaScript enabled to view it.	
0005	Test Product 2	    TEST002	    This email address is being protected from spambots. You need JavaScript enabled to view it.	
0006	Test Product 1	    TEST001	    This email address is being protected from spambots. You need JavaScript enabled to view it.	
0007	Test Product 1	    TEST001	    This email address is being protected from spambots. You need JavaScript enabled to view it.
  1.  RowID    Name                SKU            Account Email 
  2.  0001    Test Product 1        TEST001        This email address is being protected from spambots. You need JavaScript enabled to view it. 
  3.  0002    Test Product 1        TEST001        This email address is being protected from spambots. You need JavaScript enabled to view it. 
  4.  0003    Test Product 1        TEST001        This email address is being protected from spambots. You need JavaScript enabled to view it. 
  5.  0004    Test Product 1        TEST001        This email address is being protected from spambots. You need JavaScript enabled to view it. 
  6.  0005    Test Product 2        TEST002        This email address is being protected from spambots. You need JavaScript enabled to view it. 
  7.  0006    Test Product 1        TEST001        This email address is being protected from spambots. You need JavaScript enabled to view it. 
  8.  0007    Test Product 1        TEST001        This email address is being protected from spambots. You need JavaScript enabled to view it. 
The code is a for loop which iterates through each row, assigning an entry for a new product or account, and specifying the quantity for each.

How?
So depending on the number of levels, the count will be with a series if then else statements. See the results/yield section to determine which best fits your scenario:
Category: Zoho :: Article: 693

What?
A quick reminder on when I want to apply overall Tax or remove Tax from a quotes product line items.

Why?
I would apply the standard update function and although the response would say it modified the record, the tax wouldn't apply both visually and programmatically.

How?
A little undocumented this "feature" but the gist is if you want to add tax, it has to be built up in the tax options, if you want this to be zero, you need to pass the option of tax as zero and remove all other options.

Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com

RSS Feed

Related Articles

Joes Revolver Map

Joes Word Cloud

list   data   case   used   user   added   function   note   form   page   parameter   file   using   files   script   time   work   table   joomla   zoho   uploaded   version   creator   value   error   would   name   report   code   license   following   date   windows   source   database   server   deluge   where   system   create   display   client   website   field   find   first   mysql   order   google   need   JoelLipman.Com

Accreditation

Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Paypal:
Donate to Joel Lipman via PayPal

Bitcoin:
Donate to Joel Lipman with Bitcoin bc1qf6elrdxc968h0k673l2djc9wrpazhqtxw8qqp4

Ethereum:
Donate to Joel Lipman with Ethereum 0xb038962F3809b425D661EF5D22294Cf45E02FebF
© 2024 Joel Lipman .com. All Rights Reserved.