I know it is really basic question. I want to add a property to a table.
The command I user was :
ADD PROPERTY node.total_calls IF NOT EXIST INTEGER
I can see the property being added but there is no initialized value for the property, In fact I want to set the property to have the value of one other property(called failure) at the initialization, Is there any command to do so?
Thanks
I found the answer,
I should use the update table afterward to set the value.
Related
I need to change the binding of my table when i click on a button and it is working when the table is not empty but if the table is empty it is not working
i tried this solution(because the table is already defined in xml) and it is partially working
oTable.bindItems("/CarsSet", oTable.getItems()[0].clone(), null);
the problem is when the table is empty it is not working since oTable.getItems()[0] is undefined
one cheap solution is to clone the first element template and save the reference when the Table has been rendered the first time. After that you can use it when you change the binding otherwise (if the table is empty) you will get that error.
The template item should be defined in the dependents aggregation. This way you can always clone it regardless of the state of the binding.
You can refer to this sample to check how dependents works.
The application I'm working on is a character based application. there is a field adfc.unme-code in a table and another field arbu.unit-code-shu. These two fields are shown in different windows but they must be in sync. When I update unme-code, unit-code-shu must be updated too.
Is a simple assign statement would be enough or should I do something else? Also, should I use the actual fields or a buffer?
You can use the ASSIGN statement in your code to assign both values at the same time. If there's a possibility of some other process changing those fields, you can create a database trigger procedures on each field to copy the value over to the other field. In the Data Dictionary, view the field properties and click on the "Triggers..." button to do that.
Yes, ASSIGN is used to set the value of a buffers/records field. However: certain critera needs to be met:
The buffer/record needs to be available.
You must have the "lock" of the buffer/record.
If you have the record available and locked you can simply do:
ASSIGN arbu.unit-code-shu = adfc.unme-code.
To make this code "safer" you can simply make sure that arbu is available and not locked by any other user. And finally it will handle if your assign fails because you have no lock at all.
IF AVAILABLE arbu AND NOT LOCKED arbu THEN DO:
ASSIGN arbu.unit-code-shu = adfc.unme-code NO-ERROR.
IF ERROR-STATUS:GET-NUMBER(1) = 396 THEN DO:
MESSAGE "Apparently the record is locked." VIEW-AS ALERT-BOX ERROR.
END.
END.
If you do not have the record (or the right locking) you need to look into your application and see how you can add this feature. What identifies the right record of the second table? A single id? Something else? Are there always a 1 to 1 relation between arbu and adfc etc?
Perhaps your application has a simple way of setting the value of a field. If there is a architecture at place you should try to stick to it...
As per OrientDB docs it says
The Drop Property command removes a property from the schema. This
doesn't remove the property values in records, but just change the
schema information. Records will continue to have the property values
if any.
This is creating some issues in my code, making app throw null pointer exception for dropped properties. Is there any way to drop property and remove values from existing records too.
Thanks in advance.
Found the solution here
To remove property from existing records to run following query:
UPDATE <class> REMOVE <PROPERTY> WHERE <CONDITION>
I have a parent table that contains a global variable named gStartDate.
In a child table I have placed a global variable with the identical name. It has a calculated value:
ParentTable::gStartDate
However, it appears that it never copies the date from ParentTable::gStartDate. How can I correct this?
Thanks in advance to all for any info.
Its sounds like you set the calculated field in the child table to use "global" storage. That isn't going to update unless you update the schema or create a new record in the child table.
What you want is to set the calculated field to in the child table to be "un-stored". That will update when it is needed. And when it does it will pull the correct result from the parent table.
See the image.
I'm using a FormView control with the EntityFramework. I'm trying to add a new record, but every time I leave a text box blank, instead of inserting an empty string, it tries to insert a null.
How do I control this behavior so that it will use an empty string instead of a null?
you can handle this in the different levels of your application:
1) you can set default value in ItemCreated event handler and set default value there.
2) If you have permission to modify dblayer, you can set default value for column in db (or, maybe it is already set) and then set StoreGenerationPattern to Computed (look at, for example Entity Model - How to use Database's Default Column Values while inserting)