How one can create users field like "Assigned To" field in vtigercrm? - vtiger

I have a module ABC in that i need to create another users picklist irrespective of "Assigned To" like already there for every module. I tried to create that by copying existed field for "Assigned To" in vtiger_field table. But it is not working for me nothing new happens in module ABC.
tabid : ABD(tabid)
columname : doneby
tablename : vtiger_crmentity
generatedtype : 1
uitype : 53
fieldname : doneby
fieldlabel : Inspected By
readonly : 1
presence : 2
maximumlength : 100
block : <confused>(Need clarification)
typeofdata : V~M
summaryfield : 1
i really confused with block and typeofdata field.
Can anybody help me to get users list field?

You can easily create it by modifying tablename with vtiger_abc and block is likely to be same as where you expected follow the already existed block which you identify in vtiger_field previous colums in the same table.
More ever you need to create the same name field in vtiger_abc table also which must be varchar(size).
Change the typeofdata with V~0 this is for optional. Because "Assigned To" entity field will have mandatory so if you really need it as mandatory then let it be.
update these two fields.
tablename : vtiger_abc
block : <update with existing block of same table field>

Related

Add a new colomn from value that is stored in a list of cell of the table

I'm quite new to powerbi developement, and I need your help.
I have a table build from a json :
And I want to add informations to this table, using data from the column "fille".
This cells are fill with 'List'
This 'List' are 'Record' :
And inside this record, I can find my information :
The field that I need is :
For each row of main table
set the value "avancement" of the first 'Record' of the 'List'
How can I reach to do that ?
I'm trying somthing like this, without succes :
tableDev = Table.AddColumn(tableInfoFiltree, "Dev", each tableInfoFiltree[filles]{_}{0}[nom], type text)
I try also to build a function, but, the same, I don't reach to extract the List from the cell to put it in parameter.
Thanks for the help
Try this.
= Table.AddColumn(tableInfoFiltree, "Custom", each [filles]{0}[avancement])

Django : Update column (pick column name dynamically) value

I want to update a table field by filtering the data and selecting a specific row, in below query "address1" is the field of User table which needs to be updated with value available in variable addr:
User.objects.filter(user_id=uid).update(address1=addr)
Above query works fine as I have given column name ="address1" in update option.
But my requirement is I want update field to be dynamic, i.e. it can be address1,address2, address3 (this is stored in a variable) Let's say it is stored in add_field variable then I can't use below as it will try to find add_field column in User table which is not present there:
User.objects.filter(user_id=uid).update(add_field=addr)
Query : How can I pass field name through variable/dynamically to update option in mentioned line of code or through any other option.
You can unpack a dictionary full of your keyword arguments, like so:
User.objects.filter(user_id=uid).update(**{add_field:addr})

AWS DynamoDB - How to achieve in 1 call: Add value to set, if set exists - or else instantiate set with value?

I have a users table, there is an attribute called friends, which will be a set of the id's of all the user's friends.
Initially I tried instantiating the friends attribute to an empty set when the user is created, but I get an error that you can't have an empty attribute.
So the only solution I could find if someone has no friends yet is to read the attribute on the user, if it does not exist, SET the attribute to a [new] set with the friend they are adding. If it does exist, then just perform an update with an ADD, which adds the new friend to the set.
I don't want to have to make two calls to AWS for this.
Is there a way to create the set if it doesn't exist, and if it does, add to it - all in just 1 call?
For SET data type (from DynamoDB API Reference):
ADD - If the attribute does not already exist, then the attribute and its values are added to the item. If the attribute does exist,
then the behavior of ADD depends on the data type of the attribute:
If the existing data type is a set, and if the Value is also a set,
then the Value is added to the existing set. (This is a set operation,
not mathematical addition.) For example, if the attribute value was
the set [1,2], and the ADD action specified [3], then the final
attribute value would be [1,2,3]. An error occurs if an Add action is
specified for a set attribute and the attribute type specified does
not match the existing set type. Both sets must have the same
primitive data type. For example, if the existing data type is a set
of strings, the Value must also be a set of strings. The same holds
true for number sets and binary sets.
Example:-
First update:-
The country attribute is not present in the table. The updateItem created the new attribute country with the values (IN, UK) provided.
var params = {
TableName : "Movies",
Key : {
"yearkey" : 2014,
"title" : "The Big New Movie 2"
},
UpdateExpression : "ADD country :countries",
ExpressionAttributeValues: {
':countries': docClient.createSet(["IN", "UK"])
},
ReturnValues : "UPDATED_NEW"
};
Second update:-
This time updateItem added the new value "US" and ignored the existing value "IN".
var params = {
TableName : "Movies",
Key : {
"yearkey" : 2014,
"title" : "The Big New Movie 2"
},
UpdateExpression : "ADD country :countries",
ExpressionAttributeValues: {
':countries': docClient.createSet(["IN", "US"])
},
ReturnValues : "UPDATED_NEW"
};
Here is an example of using aws command line.
aws dynamodb update-item --table-name users \
--key '{"userId": {"S": "my-user-id"}}' \
--update-expression "ADD friends :friends" \
--expression-attribute-values '{":friends": {"SS": ["friend1-id", "friend2-id"]}}'
SS indicates a set of strings (no duplicate allowed).
No need to use SET in update-expression for non-existing case; ADD will handle it.
See aws docs here.

Couchbase view using “WHERE” clause dynamically

I have Json Documents in the following format
Name :
Class :
City :
Type :
Age :
Level :
Mother :
Father :
I have a map function like this
function(doc,meta)
{
emit([doc.Name,doc.Age,doc.Type,doc.Level],null);
}
What I can do is give "name" and filter out all results but what I also want to do is give "age" only and filter out on that. For that couchbase does not provide functionality to skip "Name" key. So I have to create a new map function which has "Age" as first key, but I also have to query on only "Level" key also so like this. I would have to create many map functions for each field which obviously is not feasible so is there anything I can do apart from making new map function to achieve this type of functionality?
I can't us n1ql because I have 150 million documents so it will take a lot of time.
First of all - that is not a very good reduce function.
it does not have any filtering
function header should be function(doc, meta)
if you have mixture between json and binary objects - add meta.type == "json"
Now for the things you can do:
If you are using v4 and above (v4.1 in much more recommended) you can use N1QL and use it very similar to SQL language. (I didn't understand why you can't use n1ql)
You can emit multiple items in multiple order
i.e. if I have doc in the format of
{
"name": "Roi",
"age": 31
}
I can emit to the index two values:
function (doc, meta) {
if (meta.type=="json") {
emit(doc.name, null);
emit(doc.age, null);
}
}
Now I can query by 2 values.
this is much better than creating 2 views.
Anyway, if you have something to filter by - it is always recommended.

Informatica : something like CDC without adding any column in target table

I have a source table named A in oracle.
Initially Table A is loaded(copied) into table B
next I operate DML on Table A like Insert , Delete , Update .
How do we reflect it in table B ?
without creating any extra column in target table.
Time stamp for the row is not available.
I have to compare the rows in source and target
eg : if a row is deleted in source then it should be deleted in target.
if a row is updated then update in target and if not available in source then insert it in the target .
Please help !!
Take A and B as source.
Do a full outer join using a joiner (or if both tables are in the same databse, you can join in Source Qualifier)
In a expression create a flag based on the following scenarios.
A key fields are null => flag='Delete',
B key fields are null => flag='Insert',
Both A and B key fields are present - Compare non-key fields of A and B, if any of the fields are not equal set flag to 'Update' else 'No Change'
Now you can send the records to target(B) after applying the appropriate function using Update Strategy
If you do not want to retain the operations done in target table (as no extra column is allowed), the fastest way would simply be -
1) Truncate B
2) Insert A into B