ESdat Forums
»
Forums
»
ESlog
»
If Statments in GEDT Files
Rank: Member
Groups: Registered
Posts: 14
Thanks: 1 times
|
Hi Guys, I am try to edit the GEDTS files from ESdat to ESLog in order to get "N/A" to show is no coordinates are entered in.
Is there an IF statement that I can add to the below to show this? **HeaderInfo: Locations
x_coord: Locations.x_coord
y_coord: Locations.y_coord
Elevation: Locations.Elevation
Regadrs Ashley
|
|
|
|
Rank: Administration
Groups: Registered, Administrators Posts: 498 Location: Byron Bay Was thanked: 19 time(s) in 19 post(s)
|
Hi Ashley, You can use this syntax. CASE WHEN ____ THEN _____ ELSE ____ END. Replace the underscores with your logic, for example CASE WHEN x_coord is null THEN 'NA' ELSE x_coord END
This syntax is already used for other logic in the gedts file, which will also demonstrate it's use. Another way of doing it (not already demonstrated in the gedts file) is to use the ISNULL function, which returns the second parameter if the first is null, for example. ISNULL(x_coord,'NA'). Regards, Warwick
|
|
|
|
Rank: Member
Groups: Registered
Posts: 14
Thanks: 1 times
|
Hi Warwick,
i thought that might have been your answer.
So after writing that code I get an Error Message saying:
ITHI: HeaderInfo
[Microsoft][ODBC SQL Server Driver][SQL Server]Error converting data type varchar to float.
Is there something that I could code to fix this?
I have noticed you have code in there for
Termination_Depth_Comment: 'Termination Depth at:' + cast([total_depth] as varchar) + ' m.'
; ' ' + Termination_Comments
Is there I can fix this for the Location.x_coord?
Regards
Ash
|
|
|
|
Rank: Administration
Groups: Registered, Administrators Posts: 498 Location: Byron Bay Was thanked: 19 time(s) in 19 post(s)
|
Hi Ashley, If you get an error message "[SQL Server]Error converting data type varchar to float" you can add this around the numeric field, so that they are both text (varchar means text): Cast([YourNumericField] as varchar) Regards, Warwick
|
|
|
|
Rank: Member
Groups: Registered
Posts: 14
Thanks: 1 times
|
Thanks Warwick that's perfect
|
|
|
|
Rank: Member
Groups: Registered
Posts: 14
Thanks: 1 times
|
Hi Warwick,
With my drill dates on my log templates I am wondering if it is possible to add a ' - ' between the 2 dates but only when Date2 is shown. The Dates need to be formatted as DD-MMM-YYYY i.e. Date1 - Date2
or Date1 Below is the function a use and it doesn't work.
Case When Date_Finalised = Date_Commenced or Date_Finalised is null Then Null ELSE ' - ' + cast([Date_Finalised] as datetime) END
If I use cast([Date_Finalised] as varchar) it works but the date is in the wrong format. Could you please help Cheers Ash
|
|
|
|
Rank: Administration
Groups: Registered, Administrators Posts: 498 Location: Byron Bay Was thanked: 19 time(s) in 19 post(s)
|
|
1 user thanked Warwick Wood for this useful post.
|
|
|
ESdat Forums
»
Forums
»
ESlog
»
If Statments in GEDT Files
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.