I've build an extension with a table named after the extension.
Now I want to change the tablename and add '_items' behind it.
I changed the name in all de classes where I could find the name but to no result.
Im surely missing something but not sure what. Any help would be appreciated as where to define the table name
Within the config.xml you can change what's inside the tags to whatever table name you want it to point to. Just don't change the entity name (which is and in your case). You should not change anything in any of the classes. That's the beauty of the Magento architecture your classes do not depend on the table schema (ie table names).
Related
I have several class in my universe containing objects (dimensions, measures) pointing on fields of a database table.
For instance the objects of the class "Grant" pointing on the table "Grant_T" and the objects of the class "Procurement" pointing on the table "Procurement_T".
I would like to create a dimension "Type" containing a fixed value in each class. For the class "Grant" it should be "Grant" and for the class "Procurement", it should be "Procurement".
I need this field for my different reports because when I do an UNION (query panel in Web Intelligence) on the different classes, I need to differentiate the results . I don't know how to create a dimension with a fixed value (not pointing to a database table field).
When I tried this formula
="Grant"
It's not working. The same with:
='Grant'
Apparently, the system needs to point on a field of the database table. But there is no field there allowing me to differentiate the type of the class.
Is it possible to do that? Could you please help me to find a solution?
Thanks for your help.
Assuming you're using a database with standard SQL, the object's definition can simply be:
'Grant'
This will work in a WebI report, although it will generate a parse error in UDT ("Object not associated with a table", or something like that). The error can be ignored, but if you want to be able to parse successfully, click the "Tables" button and select the Grant_T table.
You don't need an equals sign in universe object definitions, only for WebI formulas.
Hi I would like to be able to update a view to point to a table in a different schema as in example below, change SCHEMA1 to SCHEMA2. No other change to the SQL.
Can anyone suggest an efficient way to achieve this, ideally a string replacement.
I can do CREATE OR REPLACE FORCE VIEW and provide the list of fields. This doesn't seem a good option as I have about 40 views re repoint.
CREATE OR REPLACE FORCE VIEW CUST.CustOrdersView as
SELECT field1, field2 etc.. from
SCHEMA1.CUSTOMER ;
Your problem is simply that you have hardcoded the schema name in the views' queries. Instead of that you could have created a synonym:
create synonym CUSTOMER for SCHEMA1.CUSTOMER;
Then in your view you would have simply referenced CUSTOMER.
To repoint the view to another schema you would have to change the synonyms:
create or replace synonym CUSTOMER for SCHEMA2.CUSTOMER;
That's still work but it's much easier to generate those statements from the data dictionary views than it is to change all the view queries.
(If there is a namespace clash - that is, if schema which owns the views already has an object called CUSTOMER - you would need to use a different name for the schema.)
You may not regard this as a helpful answer, because it doesn't really solve your current problem, but it may help you avoid a similar situation in the future.
Let me describe my problem:
I have a table for all my IT-Services. I reference to this table more than once, for different purposes. Most of the time I need to reference to the name of the service. That's why I keep the name as displayed value.
One Column of that table is a service_id (custom field) which is for example "Service_004". Now in a catalog request Item the User has to fill in the service_id in a reference field.
But since I have the name as displayed value, and I need it in other forms, I am unable to reference to the service_id.
Using the variable attributes field I managed to let the service be found using the autocomplete function. But in the reference field I still get the servicename. I know that I can change the display value in the dictionary, but this breaks other functions. So what I need is to change the display value just for one reference field.
Also I tried to create a new table called IT-Services2 with reference to my table IT-Services. Then I switched the display to true in the new table for my service_id, but this will even change it in the parent table.
Perhaps an onChange client script utilizing g_form.setLabelOf() ?
http://wiki.servicenow.com/index.php?title=GlideForm_(g_form)#setLabelOf
Maybe I'm not fully understanding your question...
I ran into this issue before, what you can do is create select box variable and use an on load client script to populate the list with the service_id(s) from the table you are referencing.
I would write a script include to pull the data from the table and call it from the client script via GlideAjax.
Is it possible I can translate column name from one language to another.
For example:
In one of our application, DB columns named in polish.
I want, for example when I give select * from table_name. I can read column name in English.
Create view on the top of your original table and give access to your users just to the view. For the end users hide your real table. You can map columns from original table to view column names that will have national characters.
I think the quickest way to do this is to define views (some sort of wrappers over the tables). However, this will lead to extra maintenance, as each schema change in the source tables will require a change in the correspondent view.
I am just getting into Entity Framework for the first time beyond simple examples.
I am using the model-first approach and am querying the data source with LINQ-to-Entities.
I have created an entity model that I am exposing as an OData service against a database where I do not control the schema. In my model, I have two entities that are based off of two views in this database. I've created an association between the two entities. Both views have a column with the same name.
I am getting the error:
Ambiguous column name 'columnname'. Could not use view or function 'viewname' because of binding errors.
If I was writing the SQL statement myself, I'd qualify one of the column names with an alias to prevent this issue. EF apparently isn't doing that. How do I fix this, short of changing the view? (which I cannot do) I think this does have something to do with these entities being mapped to views, instead of being mapped to actual tables.
Assuming you can change the model have you tried going into the model and just changing one of the column names? I can still see how it might be problematic if the two views are pulling back the same column from the same table. I can tell that when working directly with a model mapped to tables, having identically named columns is not a problem. Even having multiple associations to the same table is handled correctly, the Navigation Properties are automatically given unique names. Depending on which version of EF you used you should be able to dig into the cs file either under the model or under the t4 template file and see what's going on. Then you can always create a partial class to bend it to your will.