Sage 100 ProvideX SQL: Difference between revisions
WikiSysopdi (talk | contribs) (examples of using providex sql) |
WikiSysopdi (talk | contribs) No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
select {FN RTRIM(CustomerNo)} as CustomerNo from AR_CustomerContact | select {FN RTRIM(CustomerNo)} as CustomerNo from AR_CustomerContact | ||
EG 2 | |||
{FN LTRIM({FN RTRIM(ac.CustomerName)})} as CustomerName, | |||
2. Getting the curent date | 2. Getting the curent date | ||
Line 27: | Line 31: | ||
where {fn TIMESTAMPDIFF(SQL_TSI_MONTH, {fn CURDATE()}, DateCreated)} < -3 | where {fn TIMESTAMPDIFF(SQL_TSI_MONTH, {fn CURDATE()}, DateCreated)} < -3 | ||
5. Concatonate strings | |||
EG | |||
{FN CONCAT('<nowiki>https://',ac.URLAddress)}</nowiki> AS URLAddress, | |||
5. Get the Month name (DateUpdated is the field name) | |||
EG | |||
{FN MONTHNAME(DateUpdated)} | |||
6. Substring | |||
EG | |||
{FN SUBSTR("This is a long string but we just want a bit of it",1,4)} |
Latest revision as of 21:38, 25 January 2024
This page is to assist in how queries are written in ProvideX and specifically references Sage 100.
We do this with some examples.This is not definitive by any means and there may be other ways to achieve the same thing. Please contact us if you would like to provide any feedback.
1.Triming text {FN RTRIM(FIELDNAME)}
EG
select {FN RTRIM(CustomerNo)} as CustomerNo from AR_CustomerContact
EG 2
{FN LTRIM({FN RTRIM(ac.CustomerName)})} as CustomerName,
2. Getting the curent date
EG
{FN CURRENT_DATE()} as acdatadatetime
3. Display a number as Money
'$' + {FN CONVERT(BalanceDue, SQL_VARCHAR )} as BalanceDue,
4. Date Comparrison.
a. This example return the number of months between the field "DateCreated" and the current date.
where {fn TIMESTAMPDIFF(SQL_TSI_MONTH, {fn CURDATE()}, DateCreated)} < -3
5. Concatonate strings
EG
{FN CONCAT('https://',ac.URLAddress)} AS URLAddress,
5. Get the Month name (DateUpdated is the field name)
EG
{FN MONTHNAME(DateUpdated)}
6. Substring
EG
{FN SUBSTR("This is a long string but we just want a bit of it",1,4)}