How can I insert text in ANY empty field of a layout in filemaker? - text

I would like to write a script which goes to the first field of my layout, then evaluate if it is empty or not; if yes, it inserts "n.s." [not specified] and if it is not empty, it goes to the next field. And so on until the last field of my layout. In the end, it makes either a beep or a window appears saying "all done" (but this last part is optional and I can already do it).
My goal is to have a button which activates this script only when I press on it.
Up until now, I could make my script go from one field to another, but it would not write anything in the empty field it met... Aditionnally, most of the written function need a named target field and I would like to be able to go automatically from one field to another without having to change the target field name myself.
Here is my script at the moment:
Go to Field [Select/perform; Layout#1::Field#1]
If [IsEmpty ( Get ( ActiveFieldName ) )]
Insert Text [Select; "n.s."]
Go to Next Field
End If
Beep
It beeps but it doesn't write anything...
Or do you see a better solution ?

Not sure why you would need this, but if necessary, you could do it this way:
Go to Next Field
Set Variable [ $start; Value:Get ( ActiveFieldName ) ]
Loop
If [ IsEmpty ( Get ( ActiveFieldContents ) ) ]
Insert Text [ “n.s.” ]
End If
Go to Next Field
Exit Loop If [ Get ( ActiveFieldName ) = $start ]
End Loop
Beep
Note that this is (purposefully) not committing the record. And of course, all fields on the layout (or at least the fields that you want to include in this process) must be included in the tab order.

Related

Is there a way to use the result of last run in the current run in Shiny?

I am using Shiny to build a dynamic dashboard for the user. I used if statement to divide my code into two main parts. There is an input called "New Line" that user needs to enter "Yes" or "No" as the value for this parameter. If user selects "Yes" the first part of the code will be ran and if he selects "No", it means that the first part is ran before and just the second part of the code needs to be ran. In the second part, there are some parameters from the first part. I want for Shiny to save the results and parameters calculate from ("New Line"==Yes) and use it for the next runs("New Line"==No) until the user change the answer for "New Line" to "Yes" again.
I used observeEvent function and an action button in Shiny. But the problem is that the results of ("New Line"==Yes) can not be used for the next runs.
shinyserver(function(input,output)){
observeEvent(input$click,{
if(input$'New Line' == 'Yes'){}
if(input$'New Line' == 'No'){}
})
}
I expect whenever user enters No for the New Line and hits the action button, the code can use the variables that are calculated when the New Line was Yes. But now whenever I set New Line as No and hit the action button , R just runs the second if. I can copy and paste all the lines from first if to tell R to run all of them again but those line takes about 30 minutes and I do not want to repeat them.
You need to serialise your values somewhere.
One example:
shinyserver(function(input,output)){
observeEvent(input$click,{
if(input$'New Line' == 'Yes'){
data <- result_of_some_function()
some_other_things()
write.csv(data, "file.csv") # saving the data somewhere on disk
}
if(input$'New Line' == 'No'){
mypreviousdata = read.csv("file.csv")
something <- somefunction(mypreviousdata)
}
})
}
Other than saving to CSV, you might prefer a database or the user's cookies, or whatever.

How to set up prefixes on saved search for multiple choices in netsuite?

I have a multiple select field that allows multiple selections of colors. I created a formula that would append a prefix of "color-" to each selected list, but it only appends it to the the beginning of the field. I'm not sure how I can split the field results up for the formula to where I can get it showing up for all results.
CASE WHEN {custitemtag_color1} is NULL
THEN ''
ELSE 'color-'||{custitemtag_color1}
END
Results with multiple selections show: color-Black,Lime Green,White
Expected Results need to show: color-Black,color-Lime Green,color-White
What's happening is that NetSuite returns "Black,Lime Green,White" as a single result for the multi-selection, then you're prepending "color-" to that text returned. To work around it within your saved search, you could simply replace any instances of the comma (",") with ",color-":
CASE WHEN {custitemtag_color1} is NULL THEN '' ELSE 'color-'|| REPLACE({custitemtag_color1}, ',', ',color-') END

OR Formula in Word document not returning a value

I am working on a document where I need to be able to test multiple options in an if statement to see if one of them are true to decide if a paragraph displays on the document. I have been trying to figure out why my OR formula is not returning a value for me to test and I am not sure why it is not showing anything when it is updating.
I have inserted a field and added a formula within that field that I am hoping will work with my If statement to show the proper paragraph contens.
When I use an Or statement, even one as simple as { OR(1=1) } and update and toggle the field I get no result. From what I have read I should get a 1 or a 0, but I don't seem to get either of these results. The line just ends up blank. When I test it with my If formula it always shows the false result, even when the Or contains a true result.
The formula I am currently working with is:
{ IF{ OR("$event.eventType.name}" = "Birthday", "$event.eventType.name}" =
"Conference" } "Yes" "No" }
If I update and toggle the Or field it shows blank, no result either true or false, and makes the If formula show as false event on results where it should show true. As I mentioned above I even tried setting it to 1=1 and still could not get it to show as true. Not sure if there is something I am missing in working with the formula.
Any suggestions would be appreciated.
It's not clear from your post what $event.eventType.name is. Presumably it's a field generated by an Addin. In that case, you should be able to use something like:
{IF{={IF{$event.eventType.name}= "Birthday" 1 0}+{IF{$event.eventType.name}= "Conference" 1 0}# 0}> 0 "Yes" "No"}
or:
{={IF{$event.eventType.name}= "Birthday" 1 0}+{IF{$event.eventType.name}= "Conference" 1 0} \# "'Yes',,'No'"}
Note: The field brace pairs (i.e. '{ }') for the above example are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues. The spaces represented in the field constructions are all required. If your fields are a kind of mergefield, you'll need to insert 'MERGEFIELD ' at the start of each one, thus:
{MERGEFIELD $event.eventType.name}

IBM Cognos prompt value when not entered

I have a problem in report studio. please help me to figure this out..
i have a optional prompt, i want to check whether the value is selected or not..
Please help how to check..
if (?parameter? is null ) then ('1') else ('2')
or
if (ParamDisplayValue('parameter') is null ) then ('1') else ('2')
Both the above are not working..
Suppose if i select any value in the prompt then the else part works and i get the result as 2, if i wont select anything then i'm not getting the result as 1
My guess, without doing extensive testing, is that an empty optional prompt doesn't exist at all and can't be compared to null. That said, I believe there's an easy fix.
Since you know that when you select an item '?parameter? is null' will return false, '?parameter? is not null' should return true and you can reverse the logic:
if (?parameter? is not null) then ('2') else ('1')
Try to put a conditional block. Set a block variable of type boolean with this expression:
ParamDisplayValue('myParam') is null
Then go to your conditional block again switch property "current block" to yes/no.
When yes (meaning that our block variable is true so the parameter is null) add a text item and just write "All".
When no add a text item with source type as report expression and write ParamDisplayValue('myParam')
P.S: there is also a way to count how many values the user selected (so as not to display all of them 1 by 1 but just show "62 values selected") but it needs some javascript and a hidden prompt field.
Use ParamCount
More details here:
http://joesanswers.blogspot.com.au/2008/09/checking-for-empty-parameters-in-cognos.html

DB Lookup issue, Lotus Notes

I have a scenario in which there are three fields, based on the selection of First Field( 3 values in first field),the next field is getting values ( it is a dialogue list field) through DBcolumn. and then on the basis of selection of second field the third field is coming. All the above mentioned field are dialogue list field.
The issue is with multi selection, when ever multi values are selected out of first field the next fields are coming as DBColumn is used (due ot lesser values), but Since second filed has lots of values, we have to use DB Look up and here the multi selection is not fetching the data for corresponding filed.
Eg. I have a field named Database (having 3 values), and other two fields are Project(many values) and Brand.
I am using DBColumn to get Values in Project Field from Database field Selection (multi-selection), which I am getting properly (using #if), but after multi selection of Project Field (there are many values) I am not able to get values in next field (using DBLookup).
Please let me know any workaround....
First: Your code would have probably helped in solving this problem, although I think, it is not code- related:
Please check the field- property "refresh fields on keyword change" on the Project and the property "Refresh Choices on document refresh" on the Brand- Field.
If you do not get ANY- values whenever you select a second Project, then check, if your Key for Lookup is correctly used as an Multiple value for your DBLookup and that it does not try to lookup something like "value1;value2" instead of "value1" : "value2"...
Bets practice for debugging something like this, is to have a "BrandList" field, Computed for Display, hidden, with the DBLookup in it:
_viw := "YourViewName";
_crit := Project;
_col := 2;
REM "Don't do lookups, if project is empty";
#if( _crit = "" ; #Return( "" ) ; "" );
_lkp := #DBLookup( "" : "NoCache" ; _viw ; _crit ; _col );
#if( #IsError( _lkp ) ; "" ; _lkp );
And the let the brand point to this field (simply use the fieldname as Formula). that way you can easily debug the returned values.
In addition: If you are not sure, that there will be Brands for every Project you select, you need to add [FailSilent] to the lookup, otherwise the whole lookup will fail, if only one of the projects cannot be found... _lkp := #DBLookup( "" : "NoCache" ; _viw ; _crit ; _col; [Failsilent] );
BUT: Failsilent is very bad when debugging something, as you never get an error Message...
AND: For debugging purposes, you of course do NOT use the #IsError- line and simply return _lkp...

Resources