Problem setting value in rich text field with action

I have an @DbLookup formula in an action button on a form that returns a text value correctly to a text field but I want to set the value in a Rich Text field.

PromptValue1 := @PickList([Custom]:[Single]; SERVER : LOOKUPDBNAME; "MQC"; "Quick Calls"; "Please select a quick call description from the list below."; 1);
getqcvalues  := @DbLookup("Notes"; SERVER : LOOKUPDBNAME; "MQC"; PromptValue1; 2);
Look7 := @DbLookup("Notes"; SERVER : LOOKUPDBNAME; "MQC"; PromptValue1; "ProblemResolution");

FIELD BriefDesc := PromptValue1;
FIELD Category := @Word( getqcvalues; "*"; 1);
FIELD Class := @Word( getqcvalues; "*"; 2);
FIELD Product := @Word( getqcvalues; "*"; 3);
FIELD SubCategory := @Word( getqcvalues; "*"; 4);
FIELD SubClass := @Word( getqcvalues; "*"; 5);
FIELD FoundScript := @Word( getqcvalues; "*"; 6);
FIELD ProblemResolution:=Look7;

If the field is a Text field the correct value is written to the field, if it is rich text the field remains blank.
I have tried @Setfield("ProblemResolution";Look7) which works with a text field but not with RT.
Thanks.
Paul GAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Steve KnightIT ConsultancyCommented:
If it isn't working as expected perhaps try this... is Look7 only one value or multi-value, and does it return text

FIELD ProblemResolution:=@deletefield;
FIELD ProblemResolution:=Look7;

or
FIELD ProblemResolution:=@text(Look7);

Steve
0
Paul GAuthor Commented:
Thanks for your response.
Using this to update a text field returns text as a single value "This is a quick call"
I have tried the permutations you suggest
Just in case there was anything 'special' about the ProblemResolution RT field I created a Temp RT field and this also will not update.
There has to be something obvious I am missing.
0
Steve KnightIT ConsultancyCommented:
I must admit I hadn't tried this for ages as don't normally set rich text fields programatically apart from through LotusScript, I thought @formula would write to any empty RT field but appears it won't.

Best I could come up with to get working reliably without closing the document was to do it using LotusScript, either directly as part of your button, or by calling an agent from your button.

Dim ws As New notesuiworkspace
Dim uidoc As notesuidocument
Set uidoc=ws.currentdocument
If uidoc.EditMode=True Then
	uidoc.FieldSetText "Test_RT_Field","ABC123"
End If

Open in new window


Sjef - if you are around better ideas?

Steve
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Sjef BosmanGroupware ConsultantCommented:
IMHO it has to be done in LotusScript: the DbLookup cannot return rich text (99% sure). So your code has to search the view using GetFirstDocumentByKey, so you can copy over separate fields from the document directly.

Thanks for the bump Steve!
0
Paul GAuthor Commented:
Clutching at straws but I'm hoping you have slightly misinterpreted my question.
I am not trying to return rich text, the DbLookup correctly returns the text, I just can't set the RT field with the value
If it really is not possible to set a value in a Rich Text field using a formula then I'll have to return the value in another field and then trigger an LS agent as you suggest to copy the text to the RT.

You guys will probably suggest doing it all in LS but I am modifying an agent with about a 100 lines of formula with which I am familiar.

Have tried creating an LS agent and running this before saving the document but get the error
"Document has not been saved"
Could you please tweak it accordingly. Thanks

Sub Initialize
      Dim ws As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Set uidoc = ws.currentdocument
      If uidoc.EditMode = True Then
      uidoc.FieldSetText "ProblemResolution","TempPR"
      End If      
End Sub
0
Steve KnightIT ConsultancyCommented:
Perhaps put this in QuerySave... can't check at mo. if that would work but don't see why not:

Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.currentdocument

If uidoc.EditMode = True Then
      if uidoc.fieldGetText("TempPR")<>"" then
           uidoc.FieldSetText "ProblemResolution", uidoc.fieldgettext("TempPR")
           uidoc.FieldSetText "TempPR", ""
      end if
End If      

So then if the TempPR field is filled in by your @formula then when the doc is saved it fills in the ProblemResolution field based on that then clears the TempPR field so it doesn't get triggered again?

Steve
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sjef BosmanGroupware ConsultantCommented:
When you run the original Formula agent, then save and reopen the document, do you see the rich text? RT-fields do have this nasty habit of not being able to be modified in an open document. So when you open the document and you want an agent or button to modify a RT-field, it works but you must save, close and reopen the document before you can see the changes.

Sorry, my bad about the @DbLookup...
0
Paul GAuthor Commented:
Tried as you suggest in QuerySave and this works a treat.
Still find it difficult to believe that I cannot update RT using formula but c'est la vie
Many thanks Steve
0
Paul GAuthor Commented:
Sjef, no even when saved and reopened the value wasn't there.
Cheers.
0
Paul GAuthor Commented:
Many thanks
0
Steve KnightIT ConsultancyCommented:
Ah good.  Rich text are .... a strange beast at the best of times.  Great and powerful and b&^%^y confusing especially in old inherited apps.... things like parts of rich text fields with hidden details in, same field being used over time as a date, text then rich text and back again etc. as developer re-used field names - great to handle when trying to export data!

Glad it worked anyway, always a way to do it in Notes, even if not the obvious one!

Steve
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.