ABAP Alv Cell size with tooltip - abap

In my ALV I have several cells, some cells contain other icons and tooltips without content,
However when I try to put a letter in the cell, the cell takes an obscure error size in the occurrence of the tooltip text, here is my code to fill the cell.
I use the icon #SPACE\Q# to put a tooltip
This is my code :
* Si une livraison ete planifie et a ete reculee.
ELSEIF ls_plcd2-dlivr GT ls_plcd2-dlivp.
CONCATENATE '#B_SPCE\Q' text-t13 ' ' ls_plcd2-dlivr+6(2) '/' ls_plcd2-dlivr+4(2) '/' ls_plcd2-dlivr+0(4) '#M' INTO <value> RESPECTING BLANKS.
* CONCATENATE '#DENOCO\Q' text-t13 ' ' ls_plcd2-dlivr+6(2) '/' ls_plcd2-dlivr+4(2) '/' ls_plcd2-dlivr+0(4) '#' INTO <value> RESPECTING BLANKS.
ls_colcl-color-col = gc_liprc+0(1).
ls_colcl-color-int = gc_liprc+1(1).
ls_colcl-color-inv = gc_liprc+2(1).
APPEND ls_colcl TO lt_colcl.
CONCATENATE 'ls_tbxcl-' ls_plani-fldnm INTO lv_value.
ASSIGN (lv_value) TO <value>.
<value> = text-t17. " Texte Livraison reculee pour Excel
* Si une livraison ete planifie pour cette date et elle a ete avancee.
ELSEIF ls_plcd2-dlivr LT ls_plcd2-dlivp.
CONCATENATE '#B_SPCE\Q' text-t14 ' ' ls_plcd2-dlivr+6(2) '/' ls_plcd2-dlivr+4(2) '/' ls_plcd2-dlivr+0(4) '#M' INTO <value> RESPECTING BLANKS.
* CONCATENATE '#DENOCO\Q' text-t14 ' ' ls_plcd2-dlivr+6(2) '/' ls_plcd2-dlivr+4(2) '/' ls_plcd2-dlivr+0(4) '#' INTO <value> RESPECTING BLANKS.
* <value> = text-t05.
ls_colcl-color-col = gc_lipav+0(1).
ls_colcl-color-int = gc_lipav+1(1).
ls_colcl-color-inv = gc_lipav+2(1).
APPEND ls_colcl TO lt_colcl.
Screen-Copy :

Related

Create a log note in a record through controller

I created a record of crm.lead model through controller, and I also want to upload image or file in log note.
class RequestForQuote(http.Controller):
#route('/form/sinsert', type="http", auth="public", website=True, csrf=True)
def qoute_application_process(self,**kwargs):
values = {}
for field_name, field_value in kwargs.items():
values[field_name] = field_value
internal_notes = values['comment'] + ' , ' +values['commercial_company_name'] + ", " +values['contact_address']+ ' ' +values['contact_city'] +' '+ \
values['contact_state'] +' '+values['zip'] + ', '+ values['meeting_ids']
name = values['first_name'] +' '+values['last_name']
opportunity = request.env['crm.lead'].sudo().create({'name': name ,'date_deadline':values['date'],'email_from':values['email'],
'description':internal_notes,'type':'opportunity'
})
return werkzeug.utils.redirect('/form/thankyou')
enter image description here
To create an internal note, you just need to call self.message_post:
self.message_post(body="Internal note", attachments=[('Image', self.partner_id.image)])
You can read more at mail.thread

Use name_search in odoo 9

I want use name search but below example not working.
Tag 1 1234
Tag 2 2568
Tag 3 0369
After type 036 I want get Tag 3!
class MyTags(models.Model):
_name = "my.tags"
_description = "Tags"
name = fields.Char(required=True)
color = fields.Integer(string='Color Index')
#api.multi
def name_get(self):
result = []
for record in self:
name = '[' + str(record.color) + ']' + ' ' + record.name
result.append((record.id, name))
return result
#api.model
def name_search(self, name, args=None, operator='ilike', limit=100):
args = args or []
recs = self.browse()
if name:
recs = self.search([('color', '=', name)] + args, limit=limit)
if not recs:
recs = self.search([('name', operator, name)] + args, limit=limit)
return recs.name_get()
Note
Above example work fine after type or scan exactly eg. 0369 return Tag 3, but after type eg. 036 not return.
You have to use the like or ilike operator to get such searches to work. It has to be [('color', 'ilike', name)] then. If you want a more specific search pattern, you could also use =like or =ilike, but i have no example for them right now, so look into Odoo doc to find out, what they are doing.
Edit: it's also helpful to get search wildcards around the search team:
name would be '%' + name + '%' so [('name', 'ilike', '%036%')] should find 0369 tag.

Display Individual with multiple properties using sparql

I have individual that contain properties has_answer and has_choice two time.
<!-- http://www.semanticweb.org/myontology#Which_of_the_following_planet_has_the_average_speed_of_about_30Km/Seconds -->
<owl:NamedIndividual rdf:about="&myontology;Which_of_the_following_planet_has_the_average_speed_of_about_30Km/Seconds">
<rdf:type rdf:resource="&myontology;Question"/>
<rdfs:label>Which of the following planet has the average speed of about 30Km/Seconds ?</rdfs:label>
<myontology:QuestionNumber>1</myontology:QuestionNumber>
<myontology:has_answer rdf:resource="http://dbpedia.org/resource/Earth"/>
<myontology:has_choice rdf:resource="http://dbpedia.org/resource/Mars"/>
<myontology:has_choice rdf:resource="http://dbpedia.org/resource/Moon"/>
<myontology:has_score rdf:resource="&myontology;4_points"/>
<myontology:has_Level rdf:resource="&myontology;Expert"/>
</owl:NamedIndividual>
What I want to do is to get the property list from the Individual
+ "SELECT distinct ?Qs ?CorrAns ?Choice "
+ "WHERE {?Question rdf:type owl:NamedIndividual."
+ "?Question rdfs:label ?Qs. "
+ "?Question myontology:has_answer ?CorrAns."
+ "?Question myontology:has_choice ?Choice."
//
+ "}"
// + "GROUP BY ?Qs"
+ "";
...
while (rs.hasNext()) {
QuerySolution soln = rs.nextSolution();
String Qs = soln.getLiteral("Qs").getString();
RDFNode choice = soln.get("Choice");
String ans = choice.asNode().getLocalName();
RDFNode Canswer = soln.get("CorrAns");
String cans = Canswer.asNode().getLocalName();
....
that give me result as following :
Which of the following planet has the average speed of about 30Km/Seconds ? Choice : Mars CorrectAns: Earth
Which of the following planet has the average speed of about 30Km/Seconds ? Choice : Moon CorrectAns: Earth
my question is how can I do to get result in one line as following :
Which of the following planet has the average speed of about 30Km/Seconds ? || choice 1 : Mars || choice 2 : Moon || CorrecAns : Earth
is it possible with Sparql to do that ?
I solve my question by following #AKSW answers, and fix some issue in my OWL file

Build CakePHP3 query with field name as parameter

I want to build (for example) the following sql query where the position field of the matched data rows should be incremented by one:
UPDATE images SET position = position + 1 WHERE (position > 2 AND position <= 4)
I've tried to build the query with CakePHP 3's query builder:
$query->update()
->set(['position' => 'position + 1'])
->where(['position >' => 2])
->andWhere(['position <=' => 4])
->execute();
Due to the fact that position is an integer, CakePHP converts the expression 'position + 1' to 0 and don't pass 'position + 1' to the sql query.
Is there a way to build this query with the CakePHP query builder or must I use a raw sql statement for this?
the correct way to do it should be
$expression = new QueryExpression('position = position + 1');
$query->update()
->set([$expression])
->where(['position >' => 2])
->andWhere(['position <=' => 4])
->execute();
but I guess you could simply do
set(['position = position + 1']);
see the manual

Troubleshooting for Oracle ORA-30004 [duplicate]

ORA-30004 when using SYS_CONNECT_BY_PATH function, cannot have seperator as part of the column
Action: Use another seperator which does not occur in any column
value, then retry.
Error on:
select ...
Sys_Connect_By_Path(myVariable || ':' || mySecondVariable, ' --> ') "myNewVar",
...
Works:
select ...
Sys_Connect_By_Path(myVariable || ':' || mySecondVariable, ' -> ') "myNewVar",
...
In the data we found some text like this
SomeText B--More Text
SomeText A--More Text
Since there is no '-->' or for that mater no '-->' in the data why does the first one error? The second one has a space in front and on the end.
Thats because -- is a part of --> separator but not a part of -> separator.
Even if your data value has --> this query should not error. Like below.
SQL> select Sys_Connect_By_Path('SomeText B-->More Text' || ':' || 'SomeText A-->More Text', ' --> ') "myNewVar"
from dual
connect by rownum<=3;
myNewVar
----------------------------------------------------
--> SomeText B-->More Text:SomeText A-->More Text
--> SomeText B-->More Text:SomeText A-->More Text --> SomeText B-->More Text:SomeText A-->More Text
--> SomeText B-->More Text:SomeText A-->More Text --> SomeText B-->More Text:SomeText A-->More Text --> SomeText B-->More Text:SomeText A-->More Text
The separator above is -->, notice the whitespace. This whitespace is considered as part of the separator i.e. chr(1)||chr(45)||chr(45)||chr(62)||chr(1). This entire string is not a part of your data or column value.
Where as below would error
SQL> select Sys_Connect_By_Path('SomeText B-->More Text' || ':' || 'SomeText A-->More Text', '-->') "myNewVar"
from dual
connect by rownum<=3;
ORA-30004: when using SYS_CONNECT_BY_PATH function, cannot have seperator as part of column value
30004. 00000 - "when using SYS_CONNECT_BY_PATH function, cannot have seperator as part of column value"
*Cause:
*Action: Use another seperator which does not occur in any column value,
then retry.
The separator above is -->, notice there is no whitespace i.e. chr(45)||chr(45)||chr(62). This entire string is indeed a part of your data or column value and hence the error.
And here's a solution (performance un-tested)
select regexp_replace(Sys_Connect_By_Path('SomeText B-->More Text' || ':' || 'SomeText A-->More Text', ' -> '),' -> ','-->') "myNewVar"
from dual
connect by rownum<=3;
myNewVar
--------------------------------------
-->SomeText B-->More Text:SomeText A-->More Text
-->SomeText B-->More Text:SomeText A-->More Text-->SomeText B-->More Text:SomeText A-->More Text
-->SomeText B-->More Text:SomeText A-->More Text-->SomeText B-->More Text:SomeText A-->More Text-->SomeText B-->More Text:SomeText A-->More Text
Explanation - Here(in the query above) -> (with space) is not part of the data here i.e. -->. Once the column is conected by path the regexp_replace replaces all occurences of -> with --> so this way you still get to have --> as your separator instead of ->.