Why the Info change the createdDateTime Table's field? - datetime

I have to stamp with info a createdDateTime field's Table,
I used this simple code:
info( strfmt("Date-Time: %1" , myTableDate.createdDateTime) );
On myTableDate I have this value: 05/08/2015 12:48:57
On video in info I see this message:
Date-time: 05/08/2015 10:48:57
I see two hours less than the value stored in table. The field createdDateTime is the standard table's field .
Thanks all,
enjoy!

You will have to correct for timezone, as strFmt will not do it for you:
info( strfmt("Date-Time: %1", DateTimeUtil::applyTimeZoneOffset(myTableDate.createdDateTime, DateTimeUtil::getUserPreferredTimeZone()));

You need correct a timeZone^ DateTimeUtil::getUserPreferredTimeZone()

Related

Giving error in mysql Insert Query When I am insert any data but i have only name and email at start level

When I am insert any data but i have only name and email at start level
INSERT INTO `users`(`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES (3,"text","xyz#gmail.com","","","","","")
But getting error like this
#1292 - Incorrect datetime value: '' for column 'email_verified_at' at row 1
enter correct value for the field email_verified_at which empty in the query.
set the type of email_verified_at to timestamp and choose the default value to current_timestamp and then you can leave blank that field in your query, and it is better I think.

Issue with Timestamp field in Fload

I am facing an issue with the fastload where my Timestamp fields are getting rejected to error table.
Below is the value of timestamp(6) field in my flat file.
23-06-2016 11:51:21.000000 23-06-2016 11:51:21.000000
Below is my code:
SET RECORD VARTEXT "ยก";
DEFINE
TRANSACTION_SOURCE_TYPE_ID (VARCHAR(54))
,TRANSACTION_SOURCE_TYPE_CODE (VARCHAR(20))
,TRANSACTION_SOURCE_TYPE_DESC (VARCHAR(110))
,EFFECTIVE_START_DATE (VARCHAR(54))
,EFFECTIVE_END_DATE (VARCHAR(54))
,COUNTRY_CODE (VARCHAR(13))
,SOURCE_SYSTEM_ID (VARCHAR(54))
,DW_LOAD_TIMESTAMP (VARCHAR(76))
,DW_UPD_LOAD_TIMESTAMP (VARCHAR(76))
,FORCE_SKEW_KEY (VARCHAR(51))
FILE=?INPUT_FILE;
SHOW;
INSERT INTO ?DWSBKPDB.TRANSACTION_TMP
(
TRANSACTION_SOURCE_TYPE_ID
,TRANSACTION_SOURCE_TYPE_CODE
,TRANSACTION_SOURCE_TYPE_DESC
,EFFECTIVE_START_DATE
,EFFECTIVE_END_DATE
,COUNTRY_CODE
,SOURCE_SYSTEM_ID
,DW_LOAD_TIMESTAMP
,DW_UPD_LOAD_TIMESTAMP
,FORCE_SKEW_KEY
)
VALUES
(
:TRANSACTION_SOURCE_TYPE_ID
,:TRANSACTION_SOURCE_TYPE_CODE
,:TRANSACTION_SOURCE_TYPE_DESC
,:EFFECTIVE_START_DATE (DATE, FORMAT 'YYYY-MM-DD')
,:EFFECTIVE_END_DATE (DATE, FORMAT 'YYYY-MM-DD')
,:COUNTRY_CODE
,:SOURCE_SYSTEM_ID
,:DW_LOAD_TIMESTAMP (TIMESTAMP, FORMAT 'YYYY-MM-DDBHH:MI:SS.S(6)')
,:DW_UPD_LOAD_TIMESTAMP (TIMESTAMP, FORMAT 'YYYY-MM-DDBHH:MI:SS.S(6)')
,:FORCE_SKEW_KEY
);
DW_LOAD_TIMESTAMP is creating problem here.
Any idea as to why this is happening.
Regards,
Amit
Your data obviously doesn't match the FORMAT.
:DW_LOAD_TIMESTAMP(TIMESTAMP, FORMAT 'DD-MM-YYYYBHH:MI:SS.S(6)')

Invalid characters or punctuation with Excel import

I'm retrieving data from Excel from my asp.net page
The WorkSheet name is StatusPasPorts.
When I remove the column [Account Reference No.] it does work fine, but if I
use it I get
error : '' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long.
SELECT [Event Date],[Mobile Number],[Event Type Name],[Identification Method],[Customer DOB],[Account Reference No.] FROM [StatusPasPorts$] where Date] ASC
Any ideas what is missing?
Try removing the dot at the end of the column name - 'Account Reference No.'
Name it as 'Account Reference No'

How can the value of the "Quantity" field in bill of material lines be copied to the field "Height" during data entry?

When editing bill of material (BOM) lines, the value of field "Quantity" should be copied to field "Height". How can this be achieved?
See also the following two pictures:
http://www.hostingpics.net/viewer.php?id=205252BOM1.jpg
http://www.hostingpics.net/viewer.php?id=282509BOM2.jpg
Table you are looking for is called BOM.
"Quantity" field is called BOMQty.
"Height" field is called dim1.
Both BOMQty and dim1 are of type real, so there should not be any real issues initializing the values. The main question is WHEN do you need to initialize "Height" field.
For learning purposes, try playing with this code:
BOM BOM; //Table buffer
ttsBegin;
while select forUpdate BOM
{
BOM.dim1 = BOM.BOMQty;
BOM.update();
}
ttsCommit;
For just updating the field once, I would suggest using update_recordset
For initializing the height upon line creation, add this line to BOM.insert() method, before calling super():
this.dim1 = this.BOMQty;

MS Access IIF Field Exists

I am creating a report from a query where a field ABC is displayed as CAT if yes and as MOUSE if no. But unfortunately, when there are instances where the table inside the query does not contain field ABC, the report generates a error pop-up. Is there any way to by-pass this and run the report with other fields excluding the missing field?
I heard that IIF Exist function could help, but I am really blank here. I wrote the access query like below:
Iif (fieldExists(iif([ABC]=5, 'CAT', 'MOUSE'),iif([ABC]=5, 'CAT', 'MOUSE'), '')) AS TOMnJERRY
This function is maybe the shortest one to test if a field exists in Access:
Function FieldExists(ByVal Table As String, ByVal Field As String) As Boolean
On Error Resume Next
FieldExists = (DCount(Field, Table) >= 0)
End Function
How it works:
If the field exists, the expression (DCount(Field, Table) >= 0) is obviously always true, because DCount never returns a negative value. If the field doesn't exist, an error will occur and the program will jump to the next line without setting the return variable FieldExist, so this one will keep at default and this is false.
So the solution for your problem should look like this:
Iif (FieldExists('YourTable','ABC'), iif([ABC]=5, 'CAT', 'MOUSE'), '')

Resources