Specified cast is not valid  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Specified cast is not valid

Postby minhhieu106 » Fri Apr 20, 2018 7:20 pm

Hi Mike,

I got this errors when click on System Settings => Custom Form Tabs Configuration. Inventory => Maintenance


Image

---------------------------
Error
---------------------------
Error : Specified cast is not valid.

Module : IsDateValid
---------------------------
OK
---------------------------

Please help

Thanks
Attachments
System Settings.PNG
minhhieu106
Occasional Contributor
Occasional Contributor
 
Posts: 49
Joined: Thu Mar 29, 2018 3:29 pm
Topics Solved: 0

Re: Specified cast is not valid

Postby Mike.Sheen » Fri Apr 20, 2018 7:25 pm

Hi minhhieu106,

Please change your short date format in the Windows Control panel to be dd/MM/yyyy.

I can see from your Jiwa taskbar that you have MM/dd/yyyy format.

ControlPanel_Region.PNG
ControlPanel_Region.PNG (22.46 KiB) Viewed 1139 times


ControlPanel_Region_ShortDateFormat.PNG
ControlPanel_Region_ShortDateFormat.PNG (15.46 KiB) Viewed 1139 times


Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Specified cast is not valid

Postby minhhieu106 » Sat Apr 21, 2018 12:54 am

Hi Mike,

Are there any ways to change the datetime format on Jiwa? not change the format of OS.

Thanks,
minhhieu106
Occasional Contributor
Occasional Contributor
 
Posts: 49
Joined: Thu Mar 29, 2018 3:29 pm
Topics Solved: 0

Re: Specified cast is not valid

Postby Mike.Sheen » Sat Apr 21, 2018 11:17 am

minhhieu106 wrote:Are there any ways to change the datetime format on Jiwa? not change the format of OS.


No - but in reality these days we don't normally care about the date format. I recommended changing the date format to see if it fixed the issue, as there may still be some things depending on a specific date format.

I've checked our entire code base, all our stored procedures and all our plugins and nowhere do I see a method "IsDateValid". So, I don't know where this problem you are having is coming from.

I checked the custom forms tab code and nothing in there I can see does anything remotely related to dates - so the only thing I can think of is a plugin intercepting the load of forms or business logic - do you have any custom plugins enabled?

Did you try loading the form with the date format I recommended - and did it work?

Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Specified cast is not valid  Topic is solved

Postby Mike.Sheen » Sat Apr 21, 2018 12:23 pm

Mike.Sheen wrote:No - but in reality these days we don't normally care about the date format. I recommended changing the date format to see if it fixed the issue, as there may still be some things depending on a specific date format.


Ok - I take that back!

After changing my region settings to use date format "M/d/yyyy" I get the same error when loading the custom form tabs maintenance form.

I found the cause to be if there are any existing custom form tabs rows, it will create an instance of the linked form in order to display in a drop-down combobox the available tabs.

The problem in my case was the Inventory Maintenance form (In demo data there is by default a custom forms tab for Inventory Maintenance) - it is trying to .ToString a date:

Code: Select all
StartingTransactionDate.Value = Manager.SysDateTime.ToString("dd-MM-yy")


And this is where the error occurs - the built-in .ToString() method for datetimes must internally invoke a IsDateValid method - and that is where the problem occurs.

I've logged this as DEV-6582.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Specified cast is not valid

Postby minhhieu106 » Sat Apr 21, 2018 2:33 pm

Hi Mike,

Thanks for investigation.

I changed the format to dd/MM/yyyy. It works fine now. I also don''t have any custom plugins on Jiwa.

Thanks,
minhhieu106
Occasional Contributor
Occasional Contributor
 
Posts: 49
Joined: Thu Mar 29, 2018 3:29 pm
Topics Solved: 0

Re: Specified cast is not valid

Postby Mike.Sheen » Thu May 17, 2018 2:01 pm

FYI - whilst the specific issue was reported as a bug - DEV-6582 - I ended up implementing improvement DEV-6614 to make Jiwa no longer care what date format the machine has throughout the whole system.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Specified cast is not valid

Postby minhhieu106 » Thu May 17, 2018 10:13 pm

Thank you Mike!
minhhieu106
Occasional Contributor
Occasional Contributor
 
Posts: 49
Joined: Thu Mar 29, 2018 3:29 pm
Topics Solved: 0


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 22 guests