How to hide a field?

7 posts / 0 new
Last post
AHgp0_ID
Offline
Joined: 12/14/2016 - 05:51
How to hide a field?

Hi again,
I was looking for method, how to hide a field, but I found only one similar thread on this forum, but without an explanation which commands to use.
Assuming I have a database "db.IMD" and I want to hide field "CHAR1"
Function hide(dbase As String, fieldname As String)
Dim db As database
Set db = client.OpenDatabase(dbase)
.....Something like db.HideField(fieldname)???
End Function
 
Many Thanks
Anre

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Anre,

Unfortunately there are no functions that allow you to do that.  IDEA didn't incorporate code to change the view of the field.  The only thing you could do is to first create a view with the field hidden and then save the vw2 file.  You would then call this file from your script using Client.OpenView "MyView.VW2" and that should hide the field.  So you would have to make sure that the view file is somewhere that your script can access.

Hope that helps.

Brian

AHgp0_ID
Offline
Joined: 12/14/2016 - 05:51

Oh, that's not good, cos I have to do with different tables, which do have empty fields on unpredictable positions. May be there is the way to remove empty fields... or just extract fields which aren't empty?

AHgp0_ID
Offline
Joined: 12/14/2016 - 05:51

Hmm, that was simple enougth
Sub Main
Dim db As database
Dim task As task
Set db = Client.OpenDatabase("Tstc.txt.IMD")
Set task = db.TableManagement
task.RemoveField "CHAR2"
task.PerformTask
End Sub
Took this command out from another Script of yours.

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Actually that removes the field it doesn't hide it.  Sorry I thought you wanted to keep the field in the database and hide it not delete the field.  Depending on what type of field you are removing and how your options are set it might give an error.  If the options don't allow you to delete IDEA fields then this code will throw an error.

AHgp0_ID
Offline
Joined: 12/14/2016 - 05:51

Thanks for an advice! I will check errors, but till now it works just fine. I am checking if field is empty and removing it after, if it is empty. I have a lot of blank fields in SAP reports, cos people who do this all report a different, they use different import formats thats why I use standart import, so it could work with any report. As a result I have empty fields there | appear twice instead of once for example.
I will show the hole code when I will be ready... in a mounth or two 8)
Srry 4 mistakes, writing from my phone

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Good luck on your project, sounds interesting.